| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:17:51: Error: A value of type 'int' can't be assigned to a variable of type 'bool'. |
| // const Foo.withInvalidCondition(this.x) : assert(x); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:19:21: Error: Constant expression expected. |
| // Try inserting 'const'. |
| // : assert(bool.fromEnvironment("foo", defaultValue: null)); |
| // ^^^^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:32:24: Error: Constant evaluation error: |
| // const Foo foo2 = const Foo(0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:8:18: Context: This assertion failed with message: x is not positive |
| // : assert(x > 0, "x is not positive"), |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:32:11: Context: While analyzing: |
| // const Foo foo2 = const Foo(0); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:33:24: Error: Constant evaluation error: |
| // const Foo foo3 = const Foo.withMessage(42); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:15:18: Context: This assertion failed with message: btw foo was false |
| // : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}"); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:33:11: Context: While analyzing: |
| // const Foo foo3 = const Foo.withMessage(42); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:34:24: Error: Constant evaluation error: |
| // const Foo foo4 = const Foo.withInvalidMessage(42); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:16:56: Context: Expected constant '42' to be of type 'String', but was of type 'int'. |
| // const Foo.withInvalidMessage(this.x) : assert(x < 0, x); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:34:11: Context: While analyzing: |
| // const Foo foo4 = const Foo.withInvalidMessage(42); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:36:24: Error: Constant evaluation error: |
| // const Foo foo6 = const Foo.withNullConditionFromEnv1(42); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:19:21: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'. |
| // : assert(bool.fromEnvironment("foo", defaultValue: null)); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:36:11: Context: While analyzing: |
| // const Foo foo6 = const Foo.withNullConditionFromEnv1(42); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:37:24: Error: Constant evaluation error: |
| // const Foo foo7 = const Foo.withNullConditionFromEnv2(42); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:21:22: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'. |
| // : assert(const bool.fromEnvironment("foo", defaultValue: null)); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:37:11: Context: While analyzing: |
| // const Foo foo7 = const Foo.withNullConditionFromEnv2(42); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:38:24: Error: Constant evaluation error: |
| // const Bar bar1 = const Bar.withMessage(1); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:26:44: Context: This assertion failed with message: x is not negative |
| // const Bar.withMessage(this.x) : assert(x < 0, "x is not negative"); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:38:11: Context: While analyzing: |
| // const Bar bar1 = const Bar.withMessage(1); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:39:24: Error: Constant evaluation error: |
| // const Bar bar2 = const Bar.withMessage(0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:26:44: Context: This assertion failed with message: x is not negative |
| // const Bar.withMessage(this.x) : assert(x < 0, "x is not negative"); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:39:11: Context: While analyzing: |
| // const Bar bar2 = const Bar.withMessage(0); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:40:24: Error: Constant evaluation error: |
| // const Bar bar3 = const Bar.withoutMessage(1); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:27:47: Context: This assertion failed. |
| // const Bar.withoutMessage(this.x) : assert(x < 0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:40:11: Context: While analyzing: |
| // const Bar bar3 = const Bar.withoutMessage(1); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:41:24: Error: Constant evaluation error: |
| // const Bar bar4 = const Bar.withoutMessage(0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:27:47: Context: This assertion failed. |
| // const Bar.withoutMessage(this.x) : assert(x < 0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:41:11: Context: While analyzing: |
| // const Bar bar4 = const Bar.withoutMessage(0); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:42:24: Error: Constant evaluation error: |
| // const Bar bar5 = const Bar.withEmptyMessage(1); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:28:49: Context: This assertion failed. |
| // const Bar.withEmptyMessage(this.x) : assert(x < 0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:42:11: Context: While analyzing: |
| // const Bar bar5 = const Bar.withEmptyMessage(1); |
| // ^ |
| // |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:43:24: Error: Constant evaluation error: |
| // const Bar bar6 = const Bar.withEmptyMessage(0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:28:49: Context: This assertion failed. |
| // const Bar.withEmptyMessage(this.x) : assert(x < 0); |
| // ^ |
| // pkg/front_end/testcases/general/constants/const_asserts.dart:43:11: Context: While analyzing: |
| // const Bar bar6 = const Bar.withEmptyMessage(0); |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| |
| class Foo extends core::Object /*hasConstConstructor*/ { |
| final field core::int* x; |
| const constructor •(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(x.{core::num::>}(0), "x is not positive"), assert(x.{core::num::>}(0)), assert(x.{core::num::>}(0), ""), assert((#C1).{core::Object::==}(false), "foo was ${#C1}"), assert((#C1).{core::Object::==}(false)), super core::Object::•() |
| ; |
| const constructor withMessage(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(x.{core::num::<}(0), "btw foo was ${#C1}"), super core::Object::•() |
| ; |
| const constructor withInvalidMessage(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(x.{core::num::<}(0), x), super core::Object::•() |
| ; |
| const constructor withInvalidCondition(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(let final Never* #t1 = invalid-expression "pkg/front_end/testcases/general/constants/const_asserts.dart:17:51: Error: A value of type 'int' can't be assigned to a variable of type 'bool'. |
| const Foo.withInvalidCondition(this.x) : assert(x); |
| ^" in x as{TypeError} core::bool*), super core::Object::•() |
| ; |
| const constructor withNullConditionFromEnv1(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(#C2), super core::Object::•() |
| ; |
| const constructor withNullConditionFromEnv2(core::int* x) → self::Foo* |
| : self::Foo::x = x, assert(#C2), super core::Object::•() |
| ; |
| abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode |
| abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf |
| abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf |
| abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue |
| abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse |
| abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::== |
| abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode |
| abstract member-signature method toString() → core::String*; -> core::Object::toString |
| abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod |
| abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType |
| } |
| class Bar extends core::Object /*hasConstConstructor*/ { |
| final field core::int* x; |
| const constructor withMessage(core::int* x) → self::Bar* |
| : self::Bar::x = x, assert(x.{core::num::<}(0), "x is not negative"), super core::Object::•() |
| ; |
| const constructor withoutMessage(core::int* x) → self::Bar* |
| : self::Bar::x = x, assert(x.{core::num::<}(0)), super core::Object::•() |
| ; |
| const constructor withEmptyMessage(core::int* x) → self::Bar* |
| : self::Bar::x = x, assert(x.{core::num::<}(0)), super core::Object::•() |
| ; |
| abstract member-signature get _identityHashCode() → core::int*; -> core::Object::_identityHashCode |
| abstract member-signature method _instanceOf(dynamic instantiatorTypeArguments, dynamic functionTypeArguments, dynamic type) → core::bool*; -> core::Object::_instanceOf |
| abstract member-signature method _simpleInstanceOf(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOf |
| abstract member-signature method _simpleInstanceOfTrue(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfTrue |
| abstract member-signature method _simpleInstanceOfFalse(dynamic type) → core::bool*; -> core::Object::_simpleInstanceOfFalse |
| abstract member-signature operator ==(dynamic other) → core::bool*; -> core::Object::== |
| abstract member-signature get hashCode() → core::int*; -> core::Object::hashCode |
| abstract member-signature method toString() → core::String*; -> core::Object::toString |
| abstract member-signature method noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod |
| abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType |
| } |
| static const field self::Foo* foo1 = #C4; |
| static const field self::Foo* foo2 = invalid-expression "This assertion failed with message: x is not positive"; |
| static const field self::Foo* foo3 = invalid-expression "This assertion failed with message: btw foo was false"; |
| static const field self::Foo* foo4 = invalid-expression "Expected constant '42' to be of type 'String', but was of type 'int'."; |
| static const field self::Foo* foo5 = invalid-expression "pkg/front_end/testcases/general/constants/const_asserts.dart:17:51: Error: A value of type 'int' can't be assigned to a variable of type 'bool'. |
| const Foo.withInvalidCondition(this.x) : assert(x); |
| ^"; |
| static const field self::Foo* foo6 = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'."; |
| static const field self::Foo* foo7 = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'."; |
| static const field self::Bar* bar1 = invalid-expression "This assertion failed with message: x is not negative"; |
| static const field self::Bar* bar2 = invalid-expression "This assertion failed with message: x is not negative"; |
| static const field self::Bar* bar3 = invalid-expression "This assertion failed."; |
| static const field self::Bar* bar4 = invalid-expression "This assertion failed."; |
| static const field self::Bar* bar5 = invalid-expression "This assertion failed."; |
| static const field self::Bar* bar6 = invalid-expression "This assertion failed."; |
| static method main() → dynamic { |
| core::print(#C4); |
| } |
| |
| constants { |
| #C1 = false |
| #C2 = null |
| #C3 = 1 |
| #C4 = self::Foo {x:#C3} |
| } |
| |
| |
| Constructor coverage from constants: |
| org-dartlang-testcase:///const_asserts.dart: |
| - Foo. (from org-dartlang-testcase:///const_asserts.dart:7:9) |
| - Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9) |
| - Foo.withMessage (from org-dartlang-testcase:///const_asserts.dart:14:9) |
| - Foo.withInvalidMessage (from org-dartlang-testcase:///const_asserts.dart:16:9) |
| - Foo.withInvalidCondition (from org-dartlang-testcase:///const_asserts.dart:17:9) |
| - Foo.withNullConditionFromEnv1 (from org-dartlang-testcase:///const_asserts.dart:18:9) |
| - Foo.withNullConditionFromEnv2 (from org-dartlang-testcase:///const_asserts.dart:20:9) |
| - Bar.withMessage (from org-dartlang-testcase:///const_asserts.dart:26:9) |
| - Bar.withoutMessage (from org-dartlang-testcase:///const_asserts.dart:27:9) |
| - Bar.withEmptyMessage (from org-dartlang-testcase:///const_asserts.dart:28:9) |