mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 09:43:08 +00:00
ed571882d2
Change-Id: I2f638cbf6b0fc6e91b3666143a34eb12a66c6fea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141780 Auto-Submit: Bob Nystrom <rnystrom@google.com> Reviewed-by: Leaf Petersen <leafp@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
27 lines
844 B
Dart
27 lines
844 B
Dart
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
// Test handling of unknown constructor in const expression.
|
|
|
|
class GoodClass {
|
|
const GoodClass();
|
|
}
|
|
|
|
GoodClass? GOOD_CLASS
|
|
= const GoodClass() //# 01: ok
|
|
= const GoodClass.BAD_NAME() //# 02: compile-time error
|
|
= const GoodClass("bad arg") //# 03: compile-time error
|
|
;
|
|
|
|
const BadClass BAD_CLASS = const BadClass(); //# 04: compile-time error
|
|
BadClass BAD_CLASS = const BadClass(); //# 05: compile-time error
|
|
|
|
void main() {
|
|
try {
|
|
print(GOOD_CLASS);
|
|
print(BAD_CLASS); //# 04: continued
|
|
print(BAD_CLASS); //# 05: continued
|
|
print(const BadClass()); //# 06: compile-time error
|
|
} catch (e) {}
|
|
}
|