blob: 6e172f0d4bae43d475fe451c2eed53882ba65dec [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/constants/const_asserts2.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_asserts2.dart:28:24: Error: Constant evaluation error:
// const Foo foo2 = const Foo(0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.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_asserts2.dart:28:11: Context: While analyzing:
// const Foo foo2 = const Foo(0);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:29:24: Error: Constant evaluation error:
// const Foo foo3 = const Foo.withMessage(42);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.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_asserts2.dart:29:11: Context: While analyzing:
// const Foo foo3 = const Foo.withMessage(42);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:30:24: Error: Constant evaluation error:
// const Foo foo4 = const Foo.withInvalidMessage(42);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:16:56: Context: This assertion failed with a non-String message.
// const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:30:11: Context: While analyzing:
// const Foo foo4 = const Foo.withInvalidMessage(42);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:32:24: Error: Constant evaluation error:
// const Bar bar1 = const Bar.withMessage(1);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:22: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_asserts2.dart:32:11: Context: While analyzing:
// const Bar bar1 = const Bar.withMessage(1);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:33:24: Error: Constant evaluation error:
// const Bar bar2 = const Bar.withMessage(0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:22: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_asserts2.dart:33:11: Context: While analyzing:
// const Bar bar2 = const Bar.withMessage(0);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:34:24: Error: Constant evaluation error:
// const Bar bar3 = const Bar.withoutMessage(1);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:23:47: Context: This assertion failed.
// const Bar.withoutMessage(this.x) : assert(x < 0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:34:11: Context: While analyzing:
// const Bar bar3 = const Bar.withoutMessage(1);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:35:24: Error: Constant evaluation error:
// const Bar bar4 = const Bar.withoutMessage(0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:23:47: Context: This assertion failed.
// const Bar.withoutMessage(this.x) : assert(x < 0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:35:11: Context: While analyzing:
// const Bar bar4 = const Bar.withoutMessage(0);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:36:24: Error: Constant evaluation error:
// const Bar bar5 = const Bar.withEmptyMessage(1);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:24:49: Context: This assertion failed.
// const Bar.withEmptyMessage(this.x) : assert(x < 0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:36:11: Context: While analyzing:
// const Bar bar5 = const Bar.withEmptyMessage(1);
// ^
//
// pkg/front_end/testcases/general/constants/const_asserts2.dart:37:24: Error: Constant evaluation error:
// const Bar bar6 = const Bar.withEmptyMessage(0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:24:49: Context: This assertion failed.
// const Bar.withEmptyMessage(this.x) : assert(x < 0);
// ^
// pkg/front_end/testcases/general/constants/const_asserts2.dart:37: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){(core::num) core::bool}, "x is not positive"), assert(x.{core::num::>}(0){(core::num) core::bool}), assert(x.{core::num::>}(0){(core::num) core::bool}, ""), assert(#C1 =={core::Object::==}{(core::Object) core::bool} false, "foo was ${#C1}"), assert(#C1 =={core::Object::==}{(core::Object) core::bool} false), super core::Object::•()
;
const constructor withMessage(core::int x) self::Foo
: self::Foo::x = x, assert(x.{core::num::<}(0){(core::num) core::bool}, "btw foo was ${#C1}"), super core::Object::•()
;
const constructor withInvalidMessage(core::int x) self::Foo
: self::Foo::x = x, assert(x.{core::num::<}(0){(core::num) core::bool}, x), super core::Object::•()
;
const constructor withInvalidCondition(core::int x) self::Foo
: self::Foo::x = x, assert(invalid-expression "pkg/front_end/testcases/general/constants/const_asserts2.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,ForNonNullableByDefault} core::bool), super core::Object::•()
;
}
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){(core::num) core::bool}, "x is not negative"), super core::Object::•()
;
const constructor withoutMessage(core::int x) self::Bar
: self::Bar::x = x, assert(x.{core::num::<}(0){(core::num) core::bool}), super core::Object::•()
;
const constructor withEmptyMessage(core::int x) self::Bar
: self::Bar::x = x, assert(x.{core::num::<}(0){(core::num) core::bool}), super core::Object::•()
;
}
static const field self::Foo foo1 = #C3;
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 "This assertion failed with a non-String message.";
static const field self::Foo foo5 = invalid-expression "pkg/front_end/testcases/general/constants/const_asserts2.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::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(#C3);
}
constants {
#C1 = false
#C2 = 1
#C3 = self::Foo {x:#C2}
}
Extra constant evaluation status:
Evaluated: EqualsCall @ org-dartlang-testcase:///const_asserts2.dart:11:50 -> BoolConstant(true)
Evaluated: StringConcatenation @ org-dartlang-testcase:///const_asserts2.dart:12:59 -> StringConstant("foo was false")
Evaluated: EqualsCall @ org-dartlang-testcase:///const_asserts2.dart:13:50 -> BoolConstant(true)
Evaluated: StringConcatenation @ org-dartlang-testcase:///const_asserts2.dart:15:73 -> StringConstant("btw foo was false")
Extra constant evaluation: evaluated: 29, effectively constant: 4
Constructor coverage from constants:
org-dartlang-testcase:///const_asserts2.dart:
- Foo. (from org-dartlang-testcase:///const_asserts2.dart:7:9)
- Object. (from org-dartlang-sdk:///sdk/lib/core/object.dart:25:9)
- Foo.withMessage (from org-dartlang-testcase:///const_asserts2.dart:14:9)
- Foo.withInvalidMessage (from org-dartlang-testcase:///const_asserts2.dart:16:9)
- Foo.withInvalidCondition (from org-dartlang-testcase:///const_asserts2.dart:17:9)
- Bar.withMessage (from org-dartlang-testcase:///const_asserts2.dart:22:9)
- Bar.withoutMessage (from org-dartlang-testcase:///const_asserts2.dart:23:9)
- Bar.withEmptyMessage (from org-dartlang-testcase:///const_asserts2.dart:24:9)