blob: 3950e82ed301af2eeac85d337f80f941ac85c17d [file] [log] [blame]
library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:27:3: Error: Only static fields can be declared as const.
// Try using 'final' instead of 'const', or adding the keyword 'static'.
// const bool initialized =
// ^^^^^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:22:25: Error: 'lib' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.
// Try moving the constant from the deferred library, or removing 'deferred' from the import.
//
// const fromDeferredLib = lib.x;
// ^^^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:14:30: Warning: Operand of null-aware operation '??' has type 'bool' which excludes null.
// const bool nullAwareOnNull = barFromEnvOrNull ?? true;
// ^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:100:34: Error: The argument type 'A' can't be assigned to the parameter type 'T'.
// - 'A' is from 'pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart'.
// const Class.method(T t) : this(-t);
// ^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:123:27: Error: Optional parameter 'named' should have a default value because its type 'int' doesn't allow null.
// int procedure(int i, {int named}) => i;
// ^^^^^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:31:9: Error: Constructor is marked 'const' so all fields must be final.
// const Foo(this.value,
// ^
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:27:14: Context: Field isn't final, but constructor is 'const'.
// const bool initialized =
// ^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:22:29: Error: Constant evaluation error:
// const fromDeferredLib = lib.x;
// ^
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:22:29: Context: 'lib' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.
// Try moving the constant from the deferred library, or removing 'deferred' from the import.
//
// const fromDeferredLib = lib.x;
// ^
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:22:7: Context: While analyzing:
// const fromDeferredLib = lib.x;
// ^
//
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:77:44: Error: Constant evaluation error:
// const Symbol symbolWithInvalidName = const Symbol("42");
// ^
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:77:51: Context: The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '"42"'.
// const Symbol symbolWithInvalidName = const Symbol("42");
// ^
// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:77:14: Context: While analyzing:
// const Symbol symbolWithInvalidName = const Symbol("42");
// ^
//
import self as self;
import "dart:core" as core;
import "dart:_internal" as _in;
import "org-dartlang-testcase:///various_lib.dart" deferred as lib;
typedef F = (core::int, {named: core::int}) → core::int;
class Foo<E extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
final field core::bool saved;
final field core::bool saved2;
field core::bool initialized = #C3;
final field self::Foo::E% value;
const constructor •(self::Foo::E% value, {core::bool saved2 = #C4, core::bool x = #C5}) → self::Foo<self::Foo::E%>
: self::Foo::value = value, self::Foo::saved2 = saved2, self::Foo::saved = x, super core::Object::•()
;
}
class A extends core::Object /*hasConstConstructor*/ {
const constructor •() → self::A
: super core::Object::•()
;
operator unary-() → self::A
return this;
}
class B extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::B
: super core::Object::•()
;
operator unary-() → self::B
return this;
}
class C extends core::Object implements self::A /*hasConstConstructor*/ {
const constructor •() → self::C
: super core::Object::•()
;
operator unary-() → self::C
return this;
}
class Class<T extends self::A = self::A> extends core::Object /*hasConstConstructor*/ {
const constructor •(self::Class::T t) → self::Class<self::Class::T>
: super core::Object::•()
;
const constructor redirect(dynamic t) → self::Class<self::Class::T>
: this self::Class::•(t as{TypeError,ForDynamic,ForNonNullableByDefault} self::Class::T)
;
const constructor method(self::Class::T t) → self::Class<self::Class::T>
: this self::Class::•(let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:100:34: Error: The argument type 'A' can't be assigned to the parameter type 'T'.
- 'A' is from 'pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart'.
const Class.method(T t) : this(-t);
^" in t.{self::A::unary-}() as{TypeError,ForNonNullableByDefault} <BottomType>)
;
}
class Subclass<T extends self::A = self::A> extends self::Class<self::Subclass::T> /*hasConstConstructor*/ {
const constructor •(dynamic t) → self::Subclass<self::Subclass::T>
: super self::Class::•(t as{TypeError,ForDynamic,ForNonNullableByDefault} self::Subclass::T)
;
}
class ConstClassWithF extends core::Object /*hasConstConstructor*/ {
final field (core::int, {named: core::int}) → core::int foo;
const constructor •((core::int, {named: core::int}) → core::int foo) → self::ConstClassWithF
: self::ConstClassWithF::foo = foo, super core::Object::•()
;
}
static const field core::bool barFromEnv = #C6;
static const field core::bool hasBarEnv = #C7;
static const field core::bool? barFromEnvOrNull0 = #C10;
static const field core::bool barFromEnvOrNull = #C11;
static const field core::bool notBarFromEnvOrNull = #C12;
static const field core::bool conditionalOnNull = #C14;
static const field core::bool nullAwareOnNull = #C15;
static const field core::bool andOnNull = #C16;
static const field core::bool andOnNull2 = #C17;
static const field core::bool orOnNull = #C18;
static const field core::bool orOnNull2 = #C19;
static const field core::bool orOnNull3 = #C8;
static const field core::bool orOnNull4 = #C20;
static const field core::int fromDeferredLib = invalid-expression "'lib' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.";
static const field self::Foo<core::int> x = #C22;
static const field core::bool? y = #C8;
static const field core::bool z = #C13;
static const field core::Object maybeInt = #C23;
static const field core::bool isItInt = #C24;
static const field core::Object maybeInt2 = #C8;
static const field core::bool isItInt2 = #C13;
static const field core::int? maybeInt3 = #C9;
static const field core::bool isItInt3 = #C13;
static const field dynamic listOfNull = #C25;
static const field core::bool isListOfNull = #C8;
static const field dynamic listOfInt = #C26;
static const field core::bool isListOfInt = #C8;
static const field core::bool isList = #C8;
static const field dynamic setOfInt = #C27;
static const field core::bool isSetOfInt = #C8;
static const field dynamic mapOfInt = #C28;
static const field core::bool isMapOfInt = #C8;
static const field dynamic listOfListOfInt = #C29;
static const field core::bool isListOfListOfInt = #C8;
static const field dynamic setOfSetOfInt = #C30;
static const field core::bool isSetOfSetOfInt = #C8;
static const field dynamic mapOfMapOfInt1 = #C31;
static const field dynamic mapOfMapOfInt2 = #C32;
static const field core::bool isMapOfMapOfInt1 = #C8;
static const field core::bool isMapOfMapOfInt2 = #C8;
static const field core::Symbol symbolWithUnevaluatedParameter = #C33;
static const field core::Symbol symbolWithInvalidName = invalid-expression "The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '\"42\"'.";
static const field self::Class<self::B>? c0 = #C35;
static const field self::Class<self::A>? c1 = invalid-expression "pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:100:34: Error: The argument type 'A' can't be assigned to the parameter type 'T'.
- 'A' is from 'pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart'.
const Class.method(T t) : this(-t);
^";
static const field self::Subclass<self::B>? c2 = #C36;
static const field self::Class<self::A>? c3 = #C37;
static const field self::Class<self::B>? c4 = #C38;
static const field self::Subclass<self::A>? c5 = #C39;
static const field self::Subclass<self::B>? c6 = #C40;
static const field core::Type f = #C41;
static field self::ConstClassWithF constClassWithF1 = #C43;
static const field self::ConstClassWithF constClassWithF2 = #C43;
static const field core::bool unevaluatedBool = #C44;
static const field core::bool notUnevaluatedBool = #C45;
static const field core::bool? unevaluatedBoolOrNull = #C46;
static const field core::bool unevaluatedBoolNotNull = #C47;
static method procedure(core::int i, {core::int named = #C9}) → core::int
return i;
static method main() → dynamic {
core::print(#C48);
core::print(invalid-expression "pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart:100:34: Error: The argument type 'A' can't be assigned to the parameter type 'T'.
- 'A' is from 'pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart'.
const Class.method(T t) : this(-t);
^");
core::print(#C49);
core::print(#C50);
core::print(#C51);
core::print(#C52);
core::print(#C53);
core::print(#C54);
core::print((#C55).{self::Foo::saved});
core::print((#C56).{self::Foo::value});
}
library /*isNonNullableByDefault*/;
import self as self2;
import "dart:core" as core;
static const field core::int x = #C21;
constants {
#C1 = "foo"
#C2 = "bar"
#C3 = eval const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2))
#C4 = eval const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2))
#C5 = eval const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2))
#C6 = eval const core::bool::fromEnvironment(#C2)
#C7 = eval const core::bool::hasEnvironment(#C2)
#C8 = true
#C9 = null
#C10 = eval const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9
#C11 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!)
#C12 = eval !const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!)
#C13 = false
#C14 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!) ?{core::bool} #C8 : #C13
#C15 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!).==(#C9) ?{core::bool} #C8 : const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!)
#C16 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!) && (#C8)
#C17 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!)
#C18 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!) || (#C8)
#C19 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!) || (#C13)
#C20 = eval const core::bool::fromEnvironment(#C2, defaultValue: (const core::bool::fromEnvironment(#C2) ?{core::bool?} #C8 : #C9)!)
#C21 = 42
#C22 = eval self::Foo<core::int>{saved:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), saved2:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), initialized:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), value:#C21}
#C23 = eval const core::bool::fromEnvironment(#C1) ?{core::Object} #C21 : #C8
#C24 = eval (const core::bool::fromEnvironment(#C1) ?{core::Object} #C21 : #C8) is{ForNonNullableByDefault} core::int ?{core::bool} #C8 : #C13
#C25 = <core::Null?>[#C9]
#C26 = <core::int>[#C21]
#C27 = <core::int>{#C21}
#C28 = <core::int, core::int>{#C21:#C21)
#C29 = <core::List<core::int>>[#C26]
#C30 = <core::Set<core::int>>{#C27}
#C31 = <core::Map<core::int, core::int>, core::int>{#C28:#C21)
#C32 = <core::int, core::Map<core::int, core::int>>{#C21:#C28)
#C33 = eval const _in::Symbol::•(const core::String::fromEnvironment(#C1))
#C34 = "x"
#C35 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::B>?} #C9 : self::Class<self::B>{(self::C{}) as{ForNonNullableByDefault} self::B}
#C36 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::B>?} #C9 : self::Subclass<self::B>{(self::C{}) as{ForNonNullableByDefault} self::B}
#C37 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::A>?} #C9 : self::Class<self::A>{self::A{}}
#C38 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::B>?} #C9 : self::Class<self::B>{(self::B{}) as{ForNonNullableByDefault} self::B}
#C39 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::A>?} #C9 : self::Subclass<self::A>{(self::A{}) as{ForNonNullableByDefault} self::A}
#C40 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::B>?} #C9 : self::Subclass<self::B>{(self::B{}) as{ForNonNullableByDefault} self::B}
#C41 = TypeLiteralConstant((core::int, {named: core::int}) → core::int)
#C42 = tearoff self::procedure
#C43 = self::ConstClassWithF {foo:#C42}
#C44 = eval const core::bool::fromEnvironment(#C1)
#C45 = eval !const core::bool::fromEnvironment(#C1)
#C46 = eval const core::bool::fromEnvironment(#C2) ?{core::bool?} const core::bool::fromEnvironment(#C1) : #C9
#C47 = eval (const core::bool::fromEnvironment(#C2) ?{core::bool?} const core::bool::fromEnvironment(#C1) : #C9)!
#C48 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::B>?} #C9 : self::Class<self::B>{(self::C{}) as{ForNonNullableByDefault} self::B}
#C49 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::B>?} #C9 : self::Subclass<self::B>{(self::C{}) as{ForNonNullableByDefault} self::B}
#C50 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::A>?} #C9 : self::Class<self::A>{self::A{}}
#C51 = eval const core::bool::fromEnvironment(#C34) ?{self::Class<self::B>?} #C9 : self::Class<self::B>{(self::B{}) as{ForNonNullableByDefault} self::B}
#C52 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::A>?} #C9 : self::Subclass<self::A>{(self::A{}) as{ForNonNullableByDefault} self::A}
#C53 = eval const core::bool::fromEnvironment(#C34) ?{self::Subclass<self::B>?} #C9 : self::Subclass<self::B>{(self::B{}) as{ForNonNullableByDefault} self::B}
#C54 = eval self::Foo<core::int>{saved:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), saved2:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), initialized:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), value:#C21}
#C55 = eval self::Foo<core::int>{saved:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), saved2:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), initialized:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), value:#C21}
#C56 = eval self::Foo<core::int>{saved:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), saved2:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), initialized:const core::bool::fromEnvironment(#C1, defaultValue: const core::bool::fromEnvironment(#C2)), value:#C21}
}