| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/const_functions/const_functions_const_ctor_error.dart:41:14: Error: Cannot invoke a non-'const' constructor where a const expression is expected. |
| // Try using a constructor or factory that is 'const'. |
| // const var4 = C(); |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| import "package:expect/expect.dart"; |
| |
| class Simple extends core::Object /*hasConstConstructor*/ { |
| final field core::String name; |
| const constructor •(core::String name) → self::Simple |
| : self::Simple::name = name, super core::Object::•() |
| ; |
| } |
| class Simple2 extends core::Object /*hasConstConstructor*/ { |
| final field core::String name; |
| const constructor •(core::String name) → self::Simple2 |
| : self::Simple2::name = name, super core::Object::•() |
| ; |
| } |
| class A extends core::Object /*hasConstConstructor*/ { |
| const constructor •() → self::A |
| : super core::Object::•() |
| ; |
| } |
| class B extends self::A /*hasConstConstructor*/ { |
| const constructor •() → self::B |
| : super self::A::•() |
| ; |
| } |
| class C extends core::Object { |
| field core::int? x; |
| synthetic constructor •() → self::C |
| ; |
| } |
| static const field core::String printString = "print"; |
| static const field self::Simple var1 = const self::Simple::•(self::printString); |
| static const field self::Simple2 var2 = const self::Simple2::•(self::printString); |
| static const field self::B var3 = const self::B::•(); |
| static const field dynamic var4 = invalid-expression "pkg/front_end/testcases/const_functions/const_functions_const_ctor_error.dart:41:14: Error: Cannot invoke a non-'const' constructor where a const expression is expected. |
| Try using a constructor or factory that is 'const'. |
| const var4 = C(); |
| ^"; |
| static method main() → void |
| ; |
| |
| |
| Extra constant evaluation status: |
| Evaluated: ConstructorInvocation @ org-dartlang-testcase:///const_functions_const_ctor_error.dart:12:14 -> InstanceConstant(const Simple{Simple.name: "print"}) |
| Evaluated: ConstructorInvocation @ org-dartlang-testcase:///const_functions_const_ctor_error.dart:21:14 -> InstanceConstant(const Simple2{Simple2.name: "print"}) |
| Evaluated: ConstructorInvocation @ org-dartlang-testcase:///const_functions_const_ctor_error.dart:30:14 -> InstanceConstant(const B{}) |
| Extra constant evaluation: evaluated: 5, effectively constant: 3 |