blob: aca1a1b4ac0241098bead191e1b63e8ca6db71da [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:16:51: Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
// const Foo.withInvalidCondition(this.x) : assert(x);
// ^
//
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(const core::bool::fromEnvironment("foo").{core::Object::==}(false), "foo was ${const core::bool::fromEnvironment("foo")}"), assert(const core::bool::fromEnvironment("foo").{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 ${const core::bool::fromEnvironment("foo")}"), 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<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:16: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), "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::•()
;
}
static const field self::Foo foo1 = const self::Foo::•(1);
static const field self::Foo foo2 = const self::Foo::•(0);
static const field self::Foo foo3 = const self::Foo::withMessage(42);
static const field self::Foo foo4 = const self::Foo::withInvalidMessage(42);
static const field self::Foo foo5 = const self::Foo::withInvalidCondition(42);
static const field self::Bar bar1 = const self::Bar::withMessage(1);
static const field self::Bar bar2 = const self::Bar::withMessage(0);
static const field self::Bar bar3 = const self::Bar::withoutMessage(1);
static const field self::Bar bar4 = const self::Bar::withoutMessage(0);
static method main() → dynamic
;