[CFE] Add "strong" tests of the constant evaluator
This increases our "local" coverage of the constant evaluator.
Run with something like
`pkg/front_end/test/fasta/strong_tester.dart -DupdateExpectations=true -DstressConstantEvaluator=true -DskipVm=true`
there is now almost coverage of everything (or a comment in the code
suggests that the path is probably unreachable).
Note that
`out/ReleaseX64/dart pkg/front_end/test/vm_service_coverage_constant_evaluator.dart pkg/front_end/test/fasta/strong_tester.dart -DupdateExpectations=true -DstressConstantEvaluator=true -DskipVm=true`
has erroneous misses, for instance (but not limited to) asserts.
These are caused by errors in the VM.
A follow-up CL will be created to turn on "stressConstantEvaluator" by
default and print out any sucesses in the expect files.
Change-Id: I837837be4f0487fdbe57c5107e4b3415de189177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163060
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
diff --git a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
index 1b8ff62..58d0aa5 100644
--- a/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/messages/codes_generated.dart
@@ -1194,33 +1194,32 @@
const Template<
Message Function(
String
- name)> templateConstEvalDeferredLibrary = const Template<
- Message Function(String name)>(
+ nameOKEmpty)> templateConstEvalDeferredLibrary = const Template<
+ Message Function(String nameOKEmpty)>(
messageTemplate:
- r"""'#name' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
+ r"""'#nameOKEmpty' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
tipTemplate:
r"""Try moving the constant from the deferred library, or removing 'deferred' from the import.
""",
withArguments: _withArgumentsConstEvalDeferredLibrary);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String name)> codeConstEvalDeferredLibrary =
- const Code<Message Function(String name)>(
+const Code<Message Function(String nameOKEmpty)> codeConstEvalDeferredLibrary =
+ const Code<Message Function(String nameOKEmpty)>(
"ConstEvalDeferredLibrary", templateConstEvalDeferredLibrary,
analyzerCodes: <String>[
"NON_CONSTANT_DEFAULT_VALUE_FROM_DEFERRED_LIBRARY"
]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsConstEvalDeferredLibrary(String name) {
- if (name.isEmpty) throw 'No name provided';
- name = demangleMixinApplicationName(name);
+Message _withArgumentsConstEvalDeferredLibrary(String nameOKEmpty) {
+ if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
return new Message(codeConstEvalDeferredLibrary,
message:
- """'${name}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
+ """'${nameOKEmpty}' can't be used in a constant expression because it's marked as 'deferred' which means it isn't available until loaded.""",
tip: """Try moving the constant from the deferred library, or removing 'deferred' from the import.
""",
- arguments: {'name': name});
+ arguments: {'nameOKEmpty': nameOKEmpty});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1243,53 +1242,53 @@
message: r"""This assertion failed.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<Message Function(String string)>
+const Template<Message Function(String stringOKEmpty)>
templateConstEvalFailedAssertionWithMessage =
- const Template<Message Function(String string)>(
- messageTemplate: r"""This assertion failed with message: #string""",
+ const Template<Message Function(String stringOKEmpty)>(
+ messageTemplate:
+ r"""This assertion failed with message: #stringOKEmpty""",
withArguments: _withArgumentsConstEvalFailedAssertionWithMessage);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string)>
+const Code<Message Function(String stringOKEmpty)>
codeConstEvalFailedAssertionWithMessage =
- const Code<Message Function(String string)>(
+ const Code<Message Function(String stringOKEmpty)>(
"ConstEvalFailedAssertionWithMessage",
templateConstEvalFailedAssertionWithMessage,
analyzerCodes: <String>["CONST_EVAL_THROWS_EXCEPTION"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsConstEvalFailedAssertionWithMessage(String string) {
- if (string.isEmpty) throw 'No string provided';
+Message _withArgumentsConstEvalFailedAssertionWithMessage(
+ String stringOKEmpty) {
+ if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
return new Message(codeConstEvalFailedAssertionWithMessage,
- message: """This assertion failed with message: ${string}""",
- arguments: {'string': string});
+ message: """This assertion failed with message: ${stringOKEmpty}""",
+ arguments: {'stringOKEmpty': stringOKEmpty});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Template<
- Message Function(
- String
- name)> templateConstEvalInvalidStaticInvocation = const Template<
- Message Function(String name)>(
- messageTemplate:
- r"""The invocation of '#name' is not allowed in a constant expression.""",
- withArguments: _withArgumentsConstEvalInvalidStaticInvocation);
+const Template<Message Function(String nameOKEmpty)>
+ templateConstEvalInvalidStaticInvocation =
+ const Template<Message Function(String nameOKEmpty)>(
+ messageTemplate:
+ r"""The invocation of '#nameOKEmpty' is not allowed in a constant expression.""",
+ withArguments: _withArgumentsConstEvalInvalidStaticInvocation);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String name)> codeConstEvalInvalidStaticInvocation =
- const Code<Message Function(String name)>(
+const Code<Message Function(String nameOKEmpty)>
+ codeConstEvalInvalidStaticInvocation =
+ const Code<Message Function(String nameOKEmpty)>(
"ConstEvalInvalidStaticInvocation",
templateConstEvalInvalidStaticInvocation,
analyzerCodes: <String>["CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsConstEvalInvalidStaticInvocation(String name) {
- if (name.isEmpty) throw 'No name provided';
- name = demangleMixinApplicationName(name);
+Message _withArgumentsConstEvalInvalidStaticInvocation(String nameOKEmpty) {
+ if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
return new Message(codeConstEvalInvalidStaticInvocation,
message:
- """The invocation of '${name}' is not allowed in a constant expression.""",
- arguments: {'name': name});
+ """The invocation of '${nameOKEmpty}' is not allowed in a constant expression.""",
+ arguments: {'nameOKEmpty': nameOKEmpty});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1328,27 +1327,27 @@
const Template<
Message Function(
String
- string)> templateConstEvalNonConstantVariableGet = const Template<
- Message Function(String string)>(
+ nameOKEmpty)> templateConstEvalNonConstantVariableGet = const Template<
+ Message Function(String nameOKEmpty)>(
messageTemplate:
- r"""The variable '#string' is not a constant, only constant expressions are allowed.""",
+ r"""The variable '#nameOKEmpty' is not a constant, only constant expressions are allowed.""",
withArguments: _withArgumentsConstEvalNonConstantVariableGet);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-const Code<Message Function(String string)>
+const Code<Message Function(String nameOKEmpty)>
codeConstEvalNonConstantVariableGet =
- const Code<Message Function(String string)>(
+ const Code<Message Function(String nameOKEmpty)>(
"ConstEvalNonConstantVariableGet",
templateConstEvalNonConstantVariableGet,
analyzerCodes: <String>["NON_CONSTANT_VALUE_IN_INITIALIZER"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
-Message _withArgumentsConstEvalNonConstantVariableGet(String string) {
- if (string.isEmpty) throw 'No string provided';
+Message _withArgumentsConstEvalNonConstantVariableGet(String nameOKEmpty) {
+ if (nameOKEmpty == null || nameOKEmpty.isEmpty) nameOKEmpty = '(unnamed)';
return new Message(codeConstEvalNonConstantVariableGet,
message:
- """The variable '${string}' is not a constant, only constant expressions are allowed.""",
- arguments: {'string': string});
+ """The variable '${nameOKEmpty}' is not a constant, only constant expressions are allowed.""",
+ arguments: {'nameOKEmpty': nameOKEmpty});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
index 6927bdd7..7be84f7 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart
@@ -353,34 +353,34 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
- Message Function(String string, Constant _constant, DartType _type,
- DartType _type2, bool isNonNullableByDefault)>
+ Message Function(String stringOKEmpty, Constant _constant,
+ DartType _type, DartType _type2, bool isNonNullableByDefault)>
templateConstEvalInvalidBinaryOperandType = const Template<
- Message Function(String string, Constant _constant, DartType _type,
- DartType _type2, bool isNonNullableByDefault)>(
+ Message Function(String stringOKEmpty, Constant _constant,
+ DartType _type, DartType _type2, bool isNonNullableByDefault)>(
messageTemplate:
- r"""Binary operator '#string' on '#constant' requires operand of type '#type', but was of type '#type2'.""",
+ r"""Binary operator '#stringOKEmpty' on '#constant' requires operand of type '#type', but was of type '#type2'.""",
withArguments: _withArgumentsConstEvalInvalidBinaryOperandType);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<
- Message Function(String string, Constant _constant, DartType _type,
- DartType _type2, bool isNonNullableByDefault)>
+ Message Function(String stringOKEmpty, Constant _constant,
+ DartType _type, DartType _type2, bool isNonNullableByDefault)>
codeConstEvalInvalidBinaryOperandType = const Code<
- Message Function(String string, Constant _constant, DartType _type,
- DartType _type2, bool isNonNullableByDefault)>(
+ Message Function(String stringOKEmpty, Constant _constant,
+ DartType _type, DartType _type2, bool isNonNullableByDefault)>(
"ConstEvalInvalidBinaryOperandType",
templateConstEvalInvalidBinaryOperandType,
);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsConstEvalInvalidBinaryOperandType(
- String string,
+ String stringOKEmpty,
Constant _constant,
DartType _type,
DartType _type2,
bool isNonNullableByDefault) {
- if (string.isEmpty) throw 'No string provided';
+ if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
List<Object> constantParts = labeler.labelConstant(_constant);
List<Object> typeParts = labeler.labelType(_type);
@@ -390,10 +390,10 @@
String type2 = type2Parts.join();
return new Message(codeConstEvalInvalidBinaryOperandType,
message:
- """Binary operator '${string}' on '${constant}' requires operand of type '${type}', but was of type '${type2}'.""" +
+ """Binary operator '${stringOKEmpty}' on '${constant}' requires operand of type '${type}', but was of type '${type2}'.""" +
labeler.originMessages,
arguments: {
- 'string': string,
+ 'stringOKEmpty': stringOKEmpty,
'constant': _constant,
'type': _type,
'type2': _type2
@@ -439,21 +439,21 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
- Message Function(
- String string, Constant _constant, bool isNonNullableByDefault)>
+ Message Function(String stringOKEmpty, Constant _constant,
+ bool isNonNullableByDefault)>
templateConstEvalInvalidMethodInvocation = const Template<
- Message Function(String string, Constant _constant,
+ Message Function(String stringOKEmpty, Constant _constant,
bool isNonNullableByDefault)>(
messageTemplate:
- r"""The method '#string' can't be invoked on '#constant' in a constant expression.""",
+ r"""The method '#stringOKEmpty' can't be invoked on '#constant' in a constant expression.""",
withArguments: _withArgumentsConstEvalInvalidMethodInvocation);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<
- Message Function(
- String string, Constant _constant, bool isNonNullableByDefault)>
- codeConstEvalInvalidMethodInvocation = const Code<
- Message Function(String string, Constant _constant,
+ Message Function(String stringOKEmpty, Constant _constant,
+ bool isNonNullableByDefault)> codeConstEvalInvalidMethodInvocation =
+ const Code<
+ Message Function(String stringOKEmpty, Constant _constant,
bool isNonNullableByDefault)>(
"ConstEvalInvalidMethodInvocation",
templateConstEvalInvalidMethodInvocation,
@@ -461,51 +461,51 @@
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsConstEvalInvalidMethodInvocation(
- String string, Constant _constant, bool isNonNullableByDefault) {
- if (string.isEmpty) throw 'No string provided';
+ String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
+ if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
List<Object> constantParts = labeler.labelConstant(_constant);
String constant = constantParts.join();
return new Message(codeConstEvalInvalidMethodInvocation,
message:
- """The method '${string}' can't be invoked on '${constant}' in a constant expression.""" +
+ """The method '${stringOKEmpty}' can't be invoked on '${constant}' in a constant expression.""" +
labeler.originMessages,
- arguments: {'string': string, 'constant': _constant});
+ arguments: {'stringOKEmpty': stringOKEmpty, 'constant': _constant});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
- Message Function(
- String string, Constant _constant, bool isNonNullableByDefault)>
- templateConstEvalInvalidPropertyGet = const Template<
- Message Function(String string, Constant _constant,
+ Message Function(String stringOKEmpty, Constant _constant,
+ bool isNonNullableByDefault)> templateConstEvalInvalidPropertyGet =
+ const Template<
+ Message Function(String stringOKEmpty, Constant _constant,
bool isNonNullableByDefault)>(
messageTemplate:
- r"""The property '#string' can't be accessed on '#constant' in a constant expression.""",
+ r"""The property '#stringOKEmpty' can't be accessed on '#constant' in a constant expression.""",
withArguments: _withArgumentsConstEvalInvalidPropertyGet);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<
- Message Function(
- String string, Constant _constant, bool isNonNullableByDefault)>
- codeConstEvalInvalidPropertyGet = const Code<
- Message Function(String string, Constant _constant,
+ Message Function(String stringOKEmpty, Constant _constant,
+ bool isNonNullableByDefault)> codeConstEvalInvalidPropertyGet =
+ const Code<
+ Message Function(String stringOKEmpty, Constant _constant,
bool isNonNullableByDefault)>(
"ConstEvalInvalidPropertyGet", templateConstEvalInvalidPropertyGet,
analyzerCodes: <String>["CONST_EVAL_THROWS_EXCEPTION"]);
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsConstEvalInvalidPropertyGet(
- String string, Constant _constant, bool isNonNullableByDefault) {
- if (string.isEmpty) throw 'No string provided';
+ String stringOKEmpty, Constant _constant, bool isNonNullableByDefault) {
+ if (stringOKEmpty == null || stringOKEmpty.isEmpty) stringOKEmpty = '(empty)';
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
List<Object> constantParts = labeler.labelConstant(_constant);
String constant = constantParts.join();
return new Message(codeConstEvalInvalidPropertyGet,
message:
- """The property '${string}' can't be accessed on '${constant}' in a constant expression.""" +
+ """The property '${stringOKEmpty}' can't be accessed on '${constant}' in a constant expression.""" +
labeler.originMessages,
- arguments: {'string': string, 'constant': _constant});
+ arguments: {'stringOKEmpty': stringOKEmpty, 'constant': _constant});
}
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart b/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
index 28f549f..e2f7865 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_collection_builders.dart
@@ -75,6 +75,7 @@
if (parts.last is List<Constant>) {
lastPart = parts.last;
} else {
+ // Probably unreachable.
parts.add(lastPart = <Constant>[]);
}
lastPart.add(evaluator.ensureIsSubtype(constant, elementType, context));
@@ -142,6 +143,7 @@
if (parts.last is List<Constant>) {
lastPart = parts.last;
} else {
+ // Probably unreachable.
parts.add(lastPart = <Constant>[]);
}
lastPart.add(evaluator.ensureIsSubtype(constant, elementType, context));
@@ -250,6 +252,7 @@
if (parts.last is List<ConstantMapEntry>) {
lastPart = parts.last;
} else {
+ // Probably unreachable.
parts.add(lastPart = <ConstantMapEntry>[]);
}
if (!evaluator.hasPrimitiveEqual(key)) {
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
index bfcc759..7998ec1 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_evaluator.dart
@@ -453,6 +453,8 @@
@override
RedirectingFactoryConstructor visitRedirectingFactoryConstructor(
RedirectingFactoryConstructor node) {
+ // Currently unreachable as the compiler doesn't produce
+ // RedirectingFactoryConstructor.
StaticTypeContext oldStaticTypeContext = _staticTypeContext;
_staticTypeContext = new StaticTypeContext(node, typeEnvironment);
constantEvaluator.withNewEnvironment(() {
@@ -1209,6 +1211,7 @@
final Class klass = constructor.enclosingClass;
if (klass.isAbstract) {
+ // Probably unreachable.
return reportInvalid(
node, 'Constructor "$node" belongs to abstract class "${klass}".');
}
@@ -1245,6 +1248,7 @@
// Fill in any missing type arguments with "dynamic".
for (int i = typeArguments.length; i < klass.typeParameters.length; i++) {
+ // Probably unreachable.
typeArguments.add(const DynamicType());
}
@@ -1276,6 +1280,7 @@
}
if (constructor.function.body != null &&
constructor.function.body is! EmptyStatement) {
+ // Probably unreachable.
reportInvalid(
node,
'Constructor "$node" has non-trivial body '
@@ -1303,6 +1308,7 @@
if (shouldBeUnevaluated) {
return unevaluated(node, instanceBuilder.buildUnevaluatedInstance());
}
+ // We can get here when re-evaluating a previously unevaluated constant.
return canonicalize(instanceBuilder.buildInstance());
});
}
@@ -1501,6 +1507,12 @@
} else if (init is AssertInitializer) {
checkAssert(init.statement);
} else {
+ // InvalidInitializer or new Initializers.
+ // Probably unreachable. InvalidInitializer is (currently) only
+ // created for classes with no constructors that doesn't have a
+ // super that takes no arguments. It thus cannot be const.
+ // Explicit constructors with incorrect super calls will get a
+ // ShadowInvalidInitializer which is actually a LocalInitializer.
return reportInvalid(
constructor,
'No support for handling initializer of type '
@@ -1574,7 +1586,9 @@
@override
Constant visitMethodInvocation(MethodInvocation node) {
// We have no support for generic method invocation atm.
- assert(node.arguments.named.isEmpty);
+ if (node.arguments.named.isNotEmpty) {
+ return reportInvalid(node, "generic method invocation");
+ }
final Constant receiver = _evaluateSubexpression(node.receiver);
final List<Constant> arguments =
@@ -1782,10 +1796,12 @@
templateConstEvalInvalidMethodInvocation.withArguments(
node.operator, left, isNonNullableByDefault));
case '??':
+ // Unreachable. LogicalExpression never created with `??`.
return (left is! NullConstant)
? left
: _evaluateSubexpression(node.right);
default:
+ // Probably unreachable.
return report(
node,
templateConstEvalInvalidMethodInvocation.withArguments(
@@ -1823,15 +1839,22 @@
@override
Constant visitPropertyGet(PropertyGet node) {
if (node.receiver is ThisExpression) {
+ // Probably unreachable unless trying to evaluate non-const stuff as
+ // const.
// Access "this" during instance creation.
if (instanceBuilder == null) {
return report(node, messageNotAConstantExpression);
}
+
for (final Field field in instanceBuilder.fields.keys) {
if (field.name == node.name) {
return instanceBuilder.fields[field];
}
}
+
+ // Meant as a "stable backstop for situations where Fasta fails to
+ // rewrite various erroneous constructs into invalid expressions".
+ // Probably unreachable.
return reportInvalid(node,
'Could not evaluate field get ${node.name} on incomplete instance');
}
@@ -1983,7 +2006,10 @@
.singleWhere((v) => v.name == 'defaultValue');
return variable.initializer != null
? _evaluateExpressionInContext(target, variable.initializer)
- : nullConstant;
+ :
+ // Not reachable unless a defaultValue in fromEnvironment in dart:core
+ // becomes null.
+ nullConstant;
}
Constant _handleFromEnvironment(
@@ -2002,6 +2028,7 @@
} else if (defaultValue is NullConstant) {
boolConstant = nullConstant;
} else {
+ // Probably unreachable.
boolConstant = falseConstant;
}
} else {
@@ -2039,6 +2066,8 @@
}
return stringConstant;
}
+ // Unreachable until fromEnvironment is added to other classes in dart:core
+ // than bool, int and String.
throw new UnsupportedError(
'Unexpected fromEnvironment constructor: $target');
}
@@ -2174,6 +2203,7 @@
// Otherwise return NNBD_SUBTYPE(S, T)
if (constant is NullConstant &&
type.nullability == Nullability.legacy) {
+ // Unreachable: Mixed strong mode is no longer supported.
return typeEnvironment.isSubtypeOf(type, typeEnvironment.nullType,
SubtypeCheckMode.ignoringNullabilities) ||
typeEnvironment.isSubtypeOf(typeEnvironment.objectLegacyRawType,
@@ -2278,6 +2308,7 @@
return canonicalize(
new PartialInstantiationConstant(constant, typeArguments));
}
+ // Probably unreachable.
return reportInvalid(
node,
'The number of type arguments supplied in the partial instantiation '
@@ -2285,6 +2316,7 @@
}
// The inner expression in an instantiation can never be null, since
// instantiations are only inferred on direct references to declarations.
+ // Probably unreachable.
return reportInvalid(
node, 'Only tear-off constants can be partially instantiated.');
}
@@ -2347,6 +2379,7 @@
if (targetingJavaScript && !result) {
if (constantType is InterfaceType &&
constantType.classNode == typeEnvironment.coreTypes.intClass) {
+ // Probably unreachable.
// With JS semantics, an integer is also a double.
result = typeEnvironment.isSubtypeOf(
new InterfaceType(typeEnvironment.coreTypes.doubleClass,
@@ -2514,6 +2547,7 @@
return makeBoolConstant(a > b);
}
+ // Probably unreachable.
return reportInvalid(node, "Unexpected binary numeric operation '$op'.");
}
@@ -2710,6 +2744,7 @@
@override
bool defaultDartType(DartType node) {
+ // Probably unreachable.
throw 'A visitor method seems to be unimplemented!';
}
@@ -2754,6 +2789,7 @@
@override
bool visitTypedefType(TypedefType node) {
+ // Probably unreachable.
return node.unalias.accept(this);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/constant_int_folder.dart b/pkg/front_end/lib/src/fasta/kernel/constant_int_folder.dart
index 337d61e..367ca58 100644
--- a/pkg/front_end/lib/src/fasta/kernel/constant_int_folder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/constant_int_folder.dart
@@ -73,6 +73,7 @@
case '~':
return new IntConstant(~operand.value);
default:
+ // Probably unreachable.
return evaluator.reportInvalid(node, "Invalid unary operator $op");
}
}
@@ -107,6 +108,7 @@
case '>>':
return new IntConstant(a >> b);
case '>>>':
+ // Currently unreachable as int hasn't defined '>>>'.
int result = b >= 64 ? 0 : (a >> b) & ((1 << (64 - b)) - 1);
return new IntConstant(result);
case '<':
@@ -118,6 +120,7 @@
case '>':
return evaluator.makeBoolConstant(a > b);
default:
+ // Probably unreachable.
return evaluator.reportInvalid(node, "Invalid binary operator $op");
}
}
@@ -154,7 +157,7 @@
@override
DoubleConstant makeIntConstant(int value, {bool unsigned: false}) {
double doubleValue = value.toDouble();
- assert(doubleValue.toInt() == value);
+ // Invalid assert: assert(doubleValue.toInt() == value);
if (unsigned) {
const double twoTo64 = 18446744073709551616.0;
if (value < 0) doubleValue += twoTo64;
@@ -172,6 +175,7 @@
int intValue = _toUint32(operand.value);
return new DoubleConstant(_truncate32(~intValue).toDouble());
default:
+ // Probably unreachable.
return evaluator.reportInvalid(node, "Invalid unary operator $op");
}
}
@@ -212,6 +216,7 @@
}
return new DoubleConstant(_truncate32(ai >> b.toInt()).toDouble());
case '>>>':
+ // Currently unreachable as int hasn't defined '>>>'.
int ai = _toUint32(a);
return new DoubleConstant(_truncate32(ai >> b.toInt()).toDouble());
case '<':
@@ -223,6 +228,7 @@
case '>':
return evaluator.makeBoolConstant(a > b);
default:
+ // Probably unreachable.
return evaluator.reportInvalid(node, "Invalid binary operator $op");
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index c4172c3..eef5d01 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -1190,6 +1190,9 @@
logger: (String msg) => ticker.logMs(msg));
}
+ constants.EvaluationMode getConstantEvaluationModeForTesting() =>
+ _getConstantEvaluationMode();
+
constants.EvaluationMode _getConstantEvaluationMode() {
constants.EvaluationMode evaluationMode;
// If nnbd is not enabled we will use weak evaluation mode. This is needed
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 803c63f..e419a4d 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -61,7 +61,12 @@
# `#unicode` a Unicode short identifier (U+xxxx). We use this to represent code
# units or code points.
#
-# `#name`, `#name2`, `#name3`, `#name4`: names (as strings).
+# `#name`, `#name2`, `#name3`, `#name4`: names (as strings). Note that asserts
+# check if these are empty. If they can be empty use an available `OKEmpty`
+# version (or add the missing needed one(s)) to avoid triggering an assert.
+#
+# `#nameOKEmpty`: name (as string). Will use an "(unnamed)" default message if
+# the string is null or empty. Otherwise see the describtion above.
#
# `#names`: A list of names (strings).
#
@@ -71,6 +76,13 @@
# Note: as a rule of thumb, avoid using the `#string` keys. In particular,
# do not use them for composing error messages, see [diagnostics.md](
# lib/src/fasta/diagnostics.md#avoid-composing-messages-programmatically).
+# Note that asserts check if these are empty. If they can be empty use an
+# available `OKEmpty` version (or add the missing needed one(s)) to avoid
+# triggering an assert.
+#
+# `#stringOKEmpty`: string (that isn't a name). Will use an "(empty)" default
+# message if the string is null or empty.
+# Otherwise see the describtion above.
#
# `#type`, #type2`, `#type3`: Kernel types.
#
@@ -117,7 +129,7 @@
template: "Expected constant '#constant' to be of type '#type', but was of type '#type2'."
ConstEvalInvalidBinaryOperandType:
- template: "Binary operator '#string' on '#constant' requires operand of type '#type', but was of type '#type2'."
+ template: "Binary operator '#stringOKEmpty' on '#constant' requires operand of type '#type', but was of type '#type2'."
ConstEvalInvalidEqualsOperandType:
template: "Binary operator '==' requires receiver constant '#constant' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type '#type'."
@@ -136,11 +148,11 @@
template: "Constant expression must be non-null."
ConstEvalInvalidMethodInvocation:
- template: "The method '#string' can't be invoked on '#constant' in a constant expression."
+ template: "The method '#stringOKEmpty' can't be invoked on '#constant' in a constant expression."
analyzerCode: UNDEFINED_OPERATOR
ConstEvalInvalidPropertyGet:
- template: "The property '#string' can't be accessed on '#constant' in a constant expression."
+ template: "The property '#stringOKEmpty' can't be accessed on '#constant' in a constant expression."
analyzerCode: CONST_EVAL_THROWS_EXCEPTION
ConstEvalInvalidStringInterpolationOperand:
@@ -150,7 +162,7 @@
analyzerCode: CONST_EVAL_TYPE_BOOL_NUM_STRING
ConstEvalInvalidStaticInvocation:
- template: "The invocation of '#name' is not allowed in a constant expression."
+ template: "The invocation of '#nameOKEmpty' is not allowed in a constant expression."
analyzerCode: CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE
ConstEvalInvalidSymbolName:
@@ -162,16 +174,16 @@
analyzerCode: CONST_EVAL_THROWS_EXCEPTION
ConstEvalFailedAssertionWithMessage:
- template: "This assertion failed with message: #string"
+ template: "This assertion failed with message: #stringOKEmpty"
analyzerCode: CONST_EVAL_THROWS_EXCEPTION
ConstEvalNonConstantVariableGet:
- template: "The variable '#string' is not a constant, only constant expressions are allowed."
+ template: "The variable '#nameOKEmpty' is not a constant, only constant expressions are allowed."
analyzerCode: NON_CONSTANT_VALUE_IN_INITIALIZER
ConstEvalDeferredLibrary:
template: >
- '#name' can't be used in a constant expression because it's marked as
+ '#nameOKEmpty' can't be used in a constant expression because it's marked as
'deferred' which means it isn't available until loaded.
tip: >
Try moving the constant from the deferred library, or removing 'deferred'
diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart
index b18d9c2..bc51b17 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -8,7 +8,7 @@
import 'dart:convert' show jsonDecode;
-import 'dart:io' show Directory, File, Platform;
+import 'dart:io' show Directory, File, Platform, stdout;
import 'package:_fe_analyzer_shared/src/util/colors.dart' as colors;
@@ -22,6 +22,9 @@
import 'package:front_end/src/api_prototype/compiler_options.dart'
show CompilerOptions, DiagnosticMessage;
+import 'package:front_end/src/api_prototype/constant_evaluator.dart'
+ show ConstantEvaluator, ErrorReporter, EvaluationMode;
+
import 'package:front_end/src/api_prototype/experimental_flags.dart'
show
AllowedExperimentalFlags,
@@ -59,18 +62,36 @@
import 'package:front_end/src/fasta/kernel/kernel_target.dart'
show KernelTarget;
+import 'package:front_end/src/fasta/messages.dart' show LocatedMessage;
+
import 'package:front_end/src/fasta/ticker.dart' show Ticker;
import 'package:front_end/src/fasta/uri_translator.dart' show UriTranslator;
+import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyComponent;
+
import 'package:kernel/ast.dart'
- show AwaitExpression, Component, Library, Node, Version, Visitor;
+ show
+ AwaitExpression,
+ BasicLiteral,
+ Component,
+ ConstantExpression,
+ Expression,
+ FileUriExpression,
+ InvalidExpression,
+ Library,
+ Member,
+ Node,
+ UnevaluatedConstant,
+ Version,
+ Visitor;
import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
import 'package:kernel/core_types.dart' show CoreTypes;
-import 'package:kernel/kernel.dart' show loadComponentFromBytes;
+import 'package:kernel/kernel.dart'
+ show RecursiveVisitor, loadComponentFromBytes;
import 'package:kernel/reference_from_index.dart' show ReferenceFromIndex;
@@ -78,7 +99,26 @@
show ChangedStructureNotifier;
import 'package:kernel/target/targets.dart'
- show NoneTarget, Target, TargetFlags, DiagnosticReporter;
+ show
+ ConstantsBackend,
+ DiagnosticReporter,
+ NoneConstantsBackend,
+ NoneTarget,
+ Target,
+ TargetFlags;
+
+import 'package:kernel/target/targets.dart'
+ show
+ ConstantsBackend,
+ DiagnosticReporter,
+ NoneConstantsBackend,
+ NoneTarget,
+ NumberSemantics,
+ Target,
+ TargetFlags;
+
+import 'package:kernel/type_environment.dart'
+ show StaticTypeContext, TypeEnvironment;
import 'package:testing/testing.dart'
show
@@ -101,7 +141,6 @@
MatchExpectation,
Print,
TypeCheck,
- Verify,
WriteDill;
import '../../utils/validating_instrumentation.dart'
@@ -154,6 +193,7 @@
const String experimentalFlagOptions = '--enable-experiment=';
const String overwriteCurrentSdkVersion = '--overwrite-current-sdk-version=';
+const String noVerifyCmd = '--no-verify';
/// Options used for all tests within a given folder.
///
@@ -166,6 +206,8 @@
final bool forceStaticFieldLowering;
final bool forceNoExplicitGetterCalls;
final bool nnbdAgnosticMode;
+ final Map<String, String> defines;
+ final bool noVerify;
final String target;
final String overwriteCurrentSdkVersion;
@@ -175,6 +217,8 @@
this.forceStaticFieldLowering: false,
this.forceNoExplicitGetterCalls: false,
this.nnbdAgnosticMode: false,
+ this.defines: const {},
+ this.noVerify: false,
this.target: "vm",
// can be null
this.overwriteCurrentSdkVersion})
@@ -183,6 +227,11 @@
assert(forceStaticFieldLowering != null),
assert(forceNoExplicitGetterCalls != null),
assert(nnbdAgnosticMode != null),
+ assert(
+ // no this doesn't make any sense but left to underline
+ // that this is allowed to be null!
+ defines != null || defines == null),
+ assert(noVerify != null),
assert(target != null);
Map<ExperimentalFlag, bool> computeExperimentalFlags(
@@ -224,6 +273,7 @@
final bool skipVm;
final bool verify;
final bool weak;
+ final bool stressConstantEvaluator;
final Map<Component, KernelTarget> componentToTarget =
<Component, KernelTarget>{};
final Map<Component, List<Iterable<String>>> componentToDiagnostics =
@@ -254,6 +304,7 @@
bool ignoreExpectations,
this.updateExpectations,
bool updateComments,
+ this.stressConstantEvaluator,
this.skipVm,
bool kernelTextSerialization,
bool fullCompile,
@@ -311,7 +362,12 @@
steps.add(const EnsureNoErrors());
if (!skipVm) {
steps.add(const WriteDill());
+ if (stressConstantEvaluator) {
+ steps.add(const StressConstantEvaluatorStep());
+ }
steps.add(const Run());
+ } else if (stressConstantEvaluator) {
+ steps.add(const StressConstantEvaluatorStep());
}
}
}
@@ -324,6 +380,8 @@
bool forceStaticFieldLowering = false;
bool forceNoExplicitGetterCalls = false;
bool nnbdAgnosticMode = false;
+ bool noVerify = false;
+ Map<String, String> defines = {};
String target = "vm";
if (directory.uri == baseUri) {
folderOptions = new FolderOptions({},
@@ -332,6 +390,8 @@
forceStaticFieldLowering: forceStaticFieldLowering,
forceNoExplicitGetterCalls: forceNoExplicitGetterCalls,
nnbdAgnosticMode: nnbdAgnosticMode,
+ defines: defines,
+ noVerify: noVerify,
target: target);
} else {
File optionsFile =
@@ -359,6 +419,38 @@
forceNoExplicitGetterCalls = true;
} else if (line.startsWith(Flags.nnbdAgnosticMode)) {
nnbdAgnosticMode = true;
+ } else if (line.startsWith(Flags.noDefines)) {
+ if (defines == null) {
+ throw "Specifying ${Flags.noDefines} several times "
+ "is unsupported.";
+ }
+ if (defines.isNotEmpty) {
+ throw "Can't have no defines and specific defines "
+ "at the same time.";
+ }
+ defines = null;
+ } else if (line.startsWith("-D")) {
+ if (defines == null) {
+ throw "Can't have no defines and specific defines "
+ "at the same time.";
+ }
+ String define = line.substring(2); // removes "-D".
+ int index = define.indexOf('=');
+ String name;
+ String expression;
+ if (index != -1) {
+ name = define.substring(0, index);
+ expression = define.substring(index + 1);
+ } else {
+ name = define;
+ expression = define;
+ }
+ if (defines.containsKey(name)) {
+ throw "Defining '$name' several times is unsupported.";
+ }
+ defines[name] = expression;
+ } else if (line.startsWith(noVerifyCmd)) {
+ noVerify = true;
} else if (line.startsWith(Flags.target) &&
line.indexOf('=') == Flags.target.length) {
target = line.substring(Flags.target.length + 1);
@@ -378,6 +470,8 @@
forceStaticFieldLowering: forceStaticFieldLowering,
forceNoExplicitGetterCalls: forceNoExplicitGetterCalls,
nnbdAgnosticMode: nnbdAgnosticMode,
+ defines: defines,
+ noVerify: noVerify,
target: target,
overwriteCurrentSdkVersion: overwriteCurrentSdkVersionArgument);
} else {
@@ -412,7 +506,7 @@
}
..sdkRoot = sdk
..packagesFileUri = uriConfiguration.packageConfigUri ?? packages
- ..environmentDefines = {}
+ ..environmentDefines = folderOptions.defines
..experimentalFlags =
folderOptions.computeExperimentalFlags(experimentalFlags)
..nnbdMode = weak
@@ -598,6 +692,8 @@
bool ignoreExpectations = environment["ignoreExpectations"] == "true";
bool updateExpectations = environment["updateExpectations"] == "true";
bool updateComments = environment["updateComments"] == "true";
+ bool stressConstantEvaluator =
+ environment["stressConstantEvaluator"] == "true";
bool skipVm = environment["skipVm"] == "true";
bool verify = environment["verify"] != "false";
bool kernelTextSerialization =
@@ -617,6 +713,7 @@
ignoreExpectations,
updateExpectations,
updateComments,
+ stressConstantEvaluator,
skipVm,
kernelTextSerialization,
environment.containsKey(ENABLE_FULL_COMPILE),
@@ -662,6 +759,7 @@
}
return process.toResult();
case "none":
+ case "noneWithJs":
return pass(0);
default:
throw new ArgumentError(
@@ -670,6 +768,152 @@
}
}
+class StressConstantEvaluatorStep
+ extends Step<ComponentResult, ComponentResult, FastaContext> {
+ const StressConstantEvaluatorStep();
+
+ String get name => "stress constant evaluator";
+
+ Future<Result<ComponentResult>> run(
+ ComponentResult result, FastaContext context) async {
+ KernelTarget target = result.sourceTarget;
+ ConstantsBackend constantsBackend =
+ target.backendTarget.constantsBackend(target.loader.coreTypes);
+ TypeEnvironment environment =
+ new TypeEnvironment(target.loader.coreTypes, target.loader.hierarchy);
+ StressConstantEvaluatorVisitor stressConstantEvaluatorVisitor =
+ new StressConstantEvaluatorVisitor(
+ constantsBackend,
+ result.options.environmentDefines,
+ target.isExperimentEnabledGlobally(ExperimentalFlag.tripleShift),
+ environment,
+ !target.backendTarget.supportsSetLiterals,
+ result.options.errorOnUnevaluatedConstant,
+ target.getConstantEvaluationModeForTesting(),
+ );
+ Stopwatch stopwatch = new Stopwatch()..start();
+ for (Library lib in result.component.libraries) {
+ if (!result.isUserLibrary(lib)) continue;
+ lib.accept(stressConstantEvaluatorVisitor);
+ }
+ stdout.writeln("\nDid extra constant evaluation in "
+ "${stopwatch.elapsedMilliseconds} ms. "
+ "Tries: ${stressConstantEvaluatorVisitor.tries}, "
+ "successes: ${stressConstantEvaluatorVisitor.success}");
+ return pass(result);
+ }
+}
+
+class StressConstantEvaluatorVisitor extends RecursiveVisitor<Node>
+ implements ErrorReporter {
+ ConstantEvaluator constantEvaluator;
+ ConstantEvaluator constantEvaluatorWithEmptyEnvironment;
+ int tries = 0;
+ int success = 0;
+
+ StressConstantEvaluatorVisitor(
+ ConstantsBackend backend,
+ Map<String, String> environmentDefines,
+ bool enableTripleShift,
+ TypeEnvironment typeEnvironment,
+ bool desugarSets,
+ bool errorOnUnevaluatedConstant,
+ EvaluationMode evaluationMode) {
+ constantEvaluator = new ConstantEvaluator(
+ backend, environmentDefines, typeEnvironment, this,
+ desugarSets: desugarSets,
+ enableTripleShift: enableTripleShift,
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
+ evaluationMode: evaluationMode);
+ constantEvaluatorWithEmptyEnvironment = new ConstantEvaluator(
+ backend, {}, typeEnvironment, this,
+ desugarSets: desugarSets,
+ enableTripleShift: enableTripleShift,
+ errorOnUnevaluatedConstant: errorOnUnevaluatedConstant,
+ evaluationMode: evaluationMode);
+ }
+
+ Member currentMember;
+
+ Node defaultMember(Member node) {
+ Member prevCurrentMember = currentMember;
+ currentMember = node;
+ node.visitChildren(this);
+ currentMember = prevCurrentMember;
+ return node;
+ }
+
+ Node defaultExpression(Expression node) {
+ if (node is BasicLiteral) return node;
+ if (node is InvalidExpression) return node;
+ if (node is ConstantExpression) {
+ bool evaluate = false;
+ if (node.constant is UnevaluatedConstant) {
+ UnevaluatedConstant unevaluatedConstant = node.constant;
+ if (unevaluatedConstant.expression is! InvalidExpression) {
+ evaluate = true;
+ }
+ }
+ if (!evaluate) return node;
+ if (constantEvaluator.environmentDefines != null) {
+ throw "Unexpected UnevaluatedConstant "
+ "when the environment is not null.";
+ }
+ }
+
+ // Try to evaluate it as a constant.
+ tries++;
+ var x = constantEvaluator.evaluate(
+ new StaticTypeContext(currentMember, constantEvaluator.typeEnvironment),
+ node);
+ bool evaluatedWithEmptyEnvironment = false;
+ if (x is UnevaluatedConstant && x.expression is! InvalidExpression) {
+ // try with an environment
+ if (constantEvaluator.environmentDefines != null) {
+ throw "Unexpected UnevaluatedConstant (with an InvalidExpression in "
+ "it) when the environment is not null.";
+ }
+ x = constantEvaluatorWithEmptyEnvironment.evaluate(
+ new StaticTypeContext(
+ currentMember, constantEvaluator.typeEnvironment),
+ new ConstantExpression(x));
+ evaluatedWithEmptyEnvironment = true;
+ }
+ if (x is UnevaluatedConstant) {
+ if (x.expression is! InvalidExpression &&
+ x.expression is! FileUriExpression) {
+ throw "Unexpected ${x.runtimeType} with "
+ "${x.expression.runtimeType} inside.";
+ }
+ node.visitChildren(this);
+ } else {
+ success++;
+ if (!evaluatedWithEmptyEnvironment) {
+ stdout
+ .writeln("Evaluated: ${node.runtimeType} @ ${node.location} -> $x");
+ // Don't recurse into children - theoretically we could replace this
+ // node with a constant expression.
+ } else {
+ stdout.writeln("Evaluated with empty environment: "
+ "${node.runtimeType} @ ${node.location} -> $x");
+ // Here we (for now) recurse into children.
+ node.visitChildren(this);
+ }
+ }
+ return node;
+ }
+
+ @override
+ void report(LocatedMessage message, List<LocatedMessage> context) {
+ // ignored.
+ }
+
+ @override
+ void reportInvalidExpression(InvalidExpression node) {
+ // ignored.
+ }
+}
+
class Outline extends Step<TestDescription, ComponentResult, FastaContext> {
final bool fullCompile;
@@ -711,7 +955,7 @@
..onDiagnostic = (DiagnosticMessage message) {
errors.add(message.plainTextFormatted);
}
- ..environmentDefines = {}
+ ..environmentDefines = folderOptions.defines
..experimentalFlags = experimentalFlags
..nnbdMode = nnbdMode
..librariesSpecificationUri = librariesSpecificationUri
@@ -754,7 +998,8 @@
}
Component p = await sourceTarget.buildOutlines();
if (fullCompile) {
- p = await sourceTarget.buildComponent(verify: context.verify);
+ p = await sourceTarget.buildComponent(
+ verify: folderOptions.noVerify ? false : context.verify);
}
// To avoid possible crash in mixin transformation in the transformation
@@ -817,21 +1062,24 @@
userLibraries.addAll(uriTranslator.dartLibraries.allLibraries
.map((LibraryInfo info) => info.importUri));
if (fullCompile) {
- p = await sourceTarget.buildComponent(verify: context.verify);
+ p = await sourceTarget.buildComponent(
+ verify: folderOptions.noVerify ? false : context.verify);
instrumentation.finish();
if (instrumentation.hasProblems) {
if (updateComments) {
await instrumentation.fixSource(description.uri, false);
} else {
return new Result<ComponentResult>(
- new ComponentResult(description, p, userLibraries),
+ new ComponentResult(
+ description, p, userLibraries, options, sourceTarget),
context.expectationSet["InstrumentationMismatch"],
instrumentation.problemsAsString,
null);
}
}
}
- return pass(new ComponentResult(description, p, userLibraries));
+ return pass(new ComponentResult(
+ description, p, userLibraries, options, sourceTarget));
});
}
@@ -862,6 +1110,9 @@
case "none":
target = new NoneTarget(targetFlags);
break;
+ case "noneWithJs":
+ target = new NoneWithJsTarget(targetFlags);
+ break;
default:
throw new ArgumentError(
"Unsupported test target '${testOptions.target}'.");
@@ -919,6 +1170,48 @@
}
}
+class Verify extends Step<ComponentResult, ComponentResult, FastaContext> {
+ final bool fullCompile;
+
+ const Verify(this.fullCompile);
+
+ String get name => "verify";
+
+ Future<Result<ComponentResult>> run(
+ ComponentResult result, FastaContext context) async {
+ FolderOptions folderOptions =
+ context.computeFolderOptions(result.description);
+
+ if (folderOptions.noVerify) {
+ return pass(result);
+ }
+
+ Component component = result.component;
+ StringBuffer messages = new StringBuffer();
+ ProcessedOptions options = new ProcessedOptions(
+ options: new CompilerOptions()
+ ..onDiagnostic = (DiagnosticMessage message) {
+ if (messages.isNotEmpty) {
+ messages.write("\n");
+ }
+ messages.writeAll(message.plainTextFormatted, "\n");
+ });
+ return await CompilerContext.runWithOptions(options,
+ (compilerContext) async {
+ compilerContext.uriToSource.addAll(component.uriToSource);
+ List<LocatedMessage> verificationErrors = verifyComponent(component,
+ isOutline: !fullCompile, skipPlatform: true);
+ assert(verificationErrors.isEmpty || messages.isNotEmpty);
+ if (messages.isEmpty) {
+ return pass(result);
+ } else {
+ return new Result<ComponentResult>(null,
+ context.expectationSet["VerificationError"], "$messages", null);
+ }
+ }, errorOnMissingInput: false);
+ }
+}
+
/// Visitor that checks that the component has been transformed properly.
// TODO(johnniwinther): Add checks for all nodes that are unsupported after
// transformation.
@@ -1033,3 +1326,19 @@
packageConfigUri == other.packageConfigUri;
}
}
+
+class NoneWithJsTarget extends NoneTarget {
+ NoneWithJsTarget(TargetFlags flags) : super(flags);
+
+ @override
+ ConstantsBackend constantsBackend(CoreTypes coreTypes) =>
+ const NoneConstantsBackendWithJs(supportsUnevaluatedConstants: true);
+}
+
+class NoneConstantsBackendWithJs extends NoneConstantsBackend {
+ const NoneConstantsBackendWithJs({bool supportsUnevaluatedConstants})
+ : super(supportsUnevaluatedConstants: supportsUnevaluatedConstants);
+
+ @override
+ NumberSemantics get numberSemantics => NumberSemantics.js;
+}
diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt
index 13b507d..bae6f0b 100644
--- a/pkg/front_end/test/spell_checking_list_code.txt
+++ b/pkg/front_end/test/spell_checking_list_code.txt
@@ -82,6 +82,7 @@
b2m
b2n
backping
+backstop
badly
bang
bar
@@ -1036,6 +1037,7 @@
stdio
stdlib
stdout
+sticky
stmt
str
strategies
diff --git a/pkg/front_end/test/spell_checking_list_messages.txt b/pkg/front_end/test/spell_checking_list_messages.txt
index 963e938..a0c8cae 100644
--- a/pkg/front_end/test/spell_checking_list_messages.txt
+++ b/pkg/front_end/test/spell_checking_list_messages.txt
@@ -36,6 +36,7 @@
loadlibrary
name.#name
name.stack
+nameokempty
native('native
nativetype
nnbd
@@ -51,6 +52,7 @@
re
sdksummary
stacktrace
+stringokempty
struct<#name
structs
super.namedconstructor
diff --git a/pkg/front_end/test/spell_checking_list_tests.txt b/pkg/front_end/test/spell_checking_list_tests.txt
index cf6a8b1..eaf2af5 100644
--- a/pkg/front_end/test/spell_checking_list_tests.txt
+++ b/pkg/front_end/test/spell_checking_list_tests.txt
@@ -55,6 +55,7 @@
beta
bigger
bkonyi
+bla
blah
blindly
blocked
@@ -70,9 +71,11 @@
brand
brave
brown
+btw
builddir
bulk2
bulkcompile
+bye
c's
c59cdee365b94ce066344840f9e3412d642019b
ca
@@ -101,6 +104,7 @@
class5c
class5d
cloneable
+cmd
cmp
cnn
coded
@@ -184,6 +188,7 @@
dispatcher
dispose
dist
+div
divergent
doctype
doesnt
@@ -262,6 +267,7 @@
forces
foreground
forrest
+forty
foundation
fox
fulfill
@@ -311,7 +317,9 @@
increments
indents
initializer2
+instance2
insufficient
+intdiv
interactive
internet
interpolate
@@ -366,6 +374,7 @@
lints
linux
listening
+literal2
ln
local1a
local1b
@@ -485,6 +494,7 @@
quit
quot
quux
+quuz
qux
r"
r"\s
@@ -518,9 +528,11 @@
retains
rev
risky
+rk
row
rows
runtimes
+rv
scans
scheduler
screen
@@ -564,6 +576,8 @@
stats
stay
std
+stress
+string2
strip
strongest
stub's
@@ -577,6 +591,7 @@
subtyping1b
subtyping2a
subtyping2b
+successes
suite
summarization
summarized
@@ -591,6 +606,7 @@
templates
test3a
test3b
+theoretically
thereof
timed
timeout
diff --git a/pkg/front_end/test/utils/kernel_chain.dart b/pkg/front_end/test/utils/kernel_chain.dart
index 9e0988a..4cef1f8 100644
--- a/pkg/front_end/test/utils/kernel_chain.dart
+++ b/pkg/front_end/test/utils/kernel_chain.dart
@@ -26,9 +26,10 @@
import 'package:front_end/src/fasta/fasta_codes.dart' show templateUnspecified;
-import 'package:front_end/src/fasta/kernel/utils.dart' show ByteSink;
+import 'package:front_end/src/fasta/kernel/kernel_target.dart'
+ show KernelTarget;
-import 'package:front_end/src/fasta/kernel/verifier.dart' show verifyComponent;
+import 'package:front_end/src/fasta/kernel/utils.dart' show ByteSink;
import 'package:front_end/src/fasta/messages.dart'
show DiagnosticMessageFromJson, LocatedMessage;
@@ -152,41 +153,6 @@
}
}
-class Verify extends Step<ComponentResult, ComponentResult, ChainContext> {
- final bool fullCompile;
-
- const Verify(this.fullCompile);
-
- String get name => "verify";
-
- Future<Result<ComponentResult>> run(
- ComponentResult result, ChainContext context) async {
- Component component = result.component;
- StringBuffer messages = new StringBuffer();
- ProcessedOptions options = new ProcessedOptions(
- options: new CompilerOptions()
- ..onDiagnostic = (DiagnosticMessage message) {
- if (messages.isNotEmpty) {
- messages.write("\n");
- }
- messages.writeAll(message.plainTextFormatted, "\n");
- });
- return await CompilerContext.runWithOptions(options,
- (compilerContext) async {
- compilerContext.uriToSource.addAll(component.uriToSource);
- List<LocatedMessage> verificationErrors = verifyComponent(component,
- isOutline: !fullCompile, skipPlatform: true);
- assert(verificationErrors.isEmpty || messages.isNotEmpty);
- if (messages.isEmpty) {
- return pass(result);
- } else {
- return new Result<ComponentResult>(null,
- context.expectationSet["VerificationError"], "$messages", null);
- }
- }, errorOnMissingInput: false);
- }
-}
-
class TypeCheck extends Step<ComponentResult, ComponentResult, ChainContext> {
const TypeCheck();
@@ -418,8 +384,8 @@
Uri uri = tmp.uri.resolve("generated.dill");
File generated = new File.fromUri(uri);
IOSink sink = generated.openWrite();
- result = new ComponentResult(
- result.description, result.component, result.userLibraries, uri);
+ result = new ComponentResult(result.description, result.component,
+ result.userLibraries, result.options, result.sourceTarget, uri);
try {
new BinaryPrinter(sink).writeComponentFile(component);
} catch (e, s) {
@@ -515,8 +481,11 @@
final Component component;
final Set<Uri> userLibraries;
final Uri outputUri;
+ final ProcessedOptions options;
+ final KernelTarget sourceTarget;
ComponentResult(this.description, this.component, this.userLibraries,
+ this.options, this.sourceTarget,
[this.outputUri]);
bool isUserLibrary(Library library) {
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart b/pkg/front_end/testcases/general/constants/const_asserts.dart
new file mode 100644
index 0000000..ddb02c6
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class Foo {
+ final int x;
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(x > 0, ""),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+ const Foo.withNullConditionFromEnv1(this.x)
+ : assert(bool.fromEnvironment("foo", defaultValue: null));
+ const Foo.withNullConditionFromEnv2(this.x)
+ : assert(const bool.fromEnvironment("foo", defaultValue: null));
+}
+
+class Bar {
+ final int x;
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+ const Bar.withEmptyMessage(this.x) : assert(x < 0);
+}
+
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+const Foo foo6 = const Foo.withNullConditionFromEnv1(42);
+const Foo foo7 = const Foo.withNullConditionFromEnv2(42);
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+const Bar bar5 = const Bar.withEmptyMessage(1);
+const Bar bar6 = const Bar.withEmptyMessage(0);
+
+main() {
+ print(foo1);
+}
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart.outline.expect b/pkg/front_end/testcases/general/constants/const_asserts.dart.outline.expect
new file mode 100644
index 0000000..e720205
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart.outline.expect
@@ -0,0 +1,86 @@
+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));
+// ^^^^^^^^^^^^^^^
+//
+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(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/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(const core::bool::fromEnvironment("foo", defaultValue: null)), super core::Object::•()
+ ;
+ const constructor withNullConditionFromEnv2(core::int* x) → self::Foo*
+ : self::Foo::x = x, assert(const core::bool::fromEnvironment("foo", defaultValue: null)), 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 = 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::Foo* foo6 = const self::Foo::withNullConditionFromEnv1(42);
+static const field self::Foo* foo7 = const self::Foo::withNullConditionFromEnv2(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 const field self::Bar* bar5 = const self::Bar::withEmptyMessage(1);
+static const field self::Bar* bar6 = const self::Bar::withEmptyMessage(0);
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.expect b/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.expect
new file mode 100644
index 0000000..5d77622
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.expect
@@ -0,0 +1,209 @@
+//
+// Problems in component:
+//
+// 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);
+// ^
+//
+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));
+// ^^^^^^^^^^^^^^^
+//
+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<BottomType> #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}
+}
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.transformed.expect
new file mode 100644
index 0000000..5d77622
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart.strong.transformed.expect
@@ -0,0 +1,209 @@
+//
+// Problems in component:
+//
+// 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);
+// ^
+//
+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));
+// ^^^^^^^^^^^^^^^
+//
+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<BottomType> #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}
+}
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline.expect
new file mode 100644
index 0000000..35c0fd4
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline.expect
@@ -0,0 +1,40 @@
+class Foo {
+ final int x;
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(x > 0, ""),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+ const Foo.withNullConditionFromEnv1(this.x)
+ : assert(bool.fromEnvironment("foo", defaultValue: null));
+ const Foo.withNullConditionFromEnv2(this.x)
+ : assert(const bool.fromEnvironment("foo", defaultValue: null));
+}
+
+class Bar {
+ final int x;
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+ const Bar.withEmptyMessage(this.x) : assert(x < 0);
+}
+
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+const Foo foo6 = const Foo.withNullConditionFromEnv1(42);
+const Foo foo7 = const Foo.withNullConditionFromEnv2(42);
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+const Bar bar5 = const Bar.withEmptyMessage(1);
+const Bar bar6 = const Bar.withEmptyMessage(0);
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..951c20d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_asserts.dart.textual_outline_modelled.expect
@@ -0,0 +1,40 @@
+class Bar {
+ const Bar.withEmptyMessage(this.x) : assert(x < 0);
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+ final int x;
+}
+
+class Foo {
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(x > 0, ""),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ const Foo.withNullConditionFromEnv1(this.x)
+ : assert(bool.fromEnvironment("foo", defaultValue: null));
+ const Foo.withNullConditionFromEnv2(this.x)
+ : assert(const bool.fromEnvironment("foo", defaultValue: null));
+ final int x;
+}
+
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+const Bar bar5 = const Bar.withEmptyMessage(1);
+const Bar bar6 = const Bar.withEmptyMessage(0);
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+const Foo foo6 = const Foo.withNullConditionFromEnv1(42);
+const Foo foo7 = const Foo.withNullConditionFromEnv2(42);
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart b/pkg/front_end/testcases/general/constants/const_collections.dart
new file mode 100644
index 0000000..90a8445
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart
@@ -0,0 +1,161 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:collection';
+
+class ConstIterable extends IterableBase<int> {
+ const ConstIterable();
+
+ Iterator<int> get iterator => <int>[].iterator;
+}
+
+const int fortyTwo = 42;
+const dynamic fortyTwoAsDynamic = ((fortyTwo as dynamic) * 2) ~/ 2;
+
+const List<String> nullList = null;
+const List<String> foo = ["hello", "world"];
+List<String> get fooAsGetter => const ["hello", "world"];
+const List<String> bar = [...foo, "!"];
+var barAsVar = [...foo, "!"];
+List<String> get barAsGetter => const [...foo, "!"];
+const List<String> barWithNullSpread = [...foo, ...nullList];
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+const List<String> barWithMapSpread = [...foo, ...quux];
+const List<String> barWithCustomIterableSpread1 = [
+ ...bar,
+ ...const CustomIterable()
+];
+const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+const customIterable = const CustomIterable();
+const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+const List<String> listConcat = ["Hello"] + ["World"];
+
+const Set<String> nullSet = null;
+const Set<String> baz = {"hello", "world"};
+Set<String> get bazAsGetter => const {"hello", "world"};
+const Set<String> qux = {...baz, "!"};
+Set<String> get quxAsGetter => const {...baz, "!"};
+const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+const Set<String> quxWithCustomIterableSpread1 = {
+ ...baz,
+ ...const CustomIterable()
+};
+const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+const Set<dynamic> setWithDuplicates = {42, 42};
+
+const Map<String, String> nullMap = null;
+const Map<String, String> quux = {"hello": "world"};
+Map<String, String> get quuxAsGetter => const {"hello": "world"};
+const Map<String, String> quuz = {...quux, "!": "bye!"};
+Map<String, String> get quuzAsGetter => const {...quux, "!": "bye!"};
+const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+const Map<String, String> mapWithSetSpread = {...baz};
+const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+const Map<String, String> customMap = const CustomMap();
+const Map<String, String> mapWithCustomMap3 = {...customMap};
+const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+ const WithEquals(42): 42
+};
+const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+
+class WithEquals {
+ final int i;
+ const WithEquals(this.i);
+ operator ==(Object o) {
+ return o is WithEquals && (o as WithEquals).i == i;
+ }
+}
+
+class CustomIterable extends IterableBase<String> {
+ const CustomIterable();
+ Iterator<String> get iterator => <String>[].iterator;
+}
+
+class CustomMap implements Map<String, String> {
+ const CustomMap();
+
+ @override
+ Iterable<MapEntry<String, String>> get entries => [];
+
+ @override
+ String operator [](Object key) => throw new UnimplementedError();
+
+ @override
+ void operator []=(String key, String value) => throw new UnimplementedError();
+
+ @override
+ Map<RK, RV> cast<RK, RV>() => throw new UnimplementedError();
+
+ @override
+ void clear() => throw new UnimplementedError();
+
+ @override
+ bool containsKey(Object key) => throw new UnimplementedError();
+
+ @override
+ bool containsValue(Object value) => throw new UnimplementedError();
+
+ @override
+ bool get isEmpty => throw new UnimplementedError();
+
+ @override
+ bool get isNotEmpty => throw new UnimplementedError();
+
+ @override
+ Iterable<String> get keys => throw new UnimplementedError();
+
+ @override
+ int get length => throw new UnimplementedError();
+
+ @override
+ String remove(Object key) => throw new UnimplementedError();
+
+ @override
+ Iterable<String> get values => throw new UnimplementedError();
+
+ @override
+ void addAll(Map<String, String> other) => throw new UnimplementedError();
+
+ @override
+ void addEntries(Iterable<MapEntry<String, String>> newEntries) =>
+ throw new UnimplementedError();
+
+ @override
+ void forEach(void f(String key, String value)) =>
+ throw new UnimplementedError();
+
+ @override
+ String putIfAbsent(String key, String ifAbsent()) =>
+ throw new UnimplementedError();
+
+ @override
+ void updateAll(String update(String key, String value)) =>
+ throw new UnimplementedError();
+
+ @override
+ void removeWhere(bool predicate(String key, String value)) =>
+ throw new UnimplementedError();
+
+ String update(String key, String update(String value), {String ifAbsent()}) =>
+ throw new UnimplementedError();
+
+ Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> f(String key, String value)) =>
+ throw new UnimplementedError();
+}
+
+main() {
+ print(bar);
+ print(qux);
+ print(quuz);
+ print({"hello"});
+ print(const {"hello"});
+}
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart.outline.expect b/pkg/front_end/testcases/general/constants/const_collections.dart.outline.expect
new file mode 100644
index 0000000..92b0447
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart.outline.expect
@@ -0,0 +1,298 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// const List<String> barWithMapSpread = [...foo, ...quux];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Set<String> quxWithMapSpread = {...baz, ...quux};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+// - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> mapWithSetSpread = {...baz};
+// ^
+//
+import self as self;
+import "dart:collection" as col;
+import "dart:core" as core;
+
+import "dart:collection";
+
+class ConstIterable extends col::IterableBase<core::int*> /*hasConstConstructor*/ {
+ const constructor •() → self::ConstIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::int*>*
+ ;
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::int*>* other) → core::Iterable<core::int*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::int*) →* self::ConstIterable::map::T* f) → core::Iterable<self::ConstIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::int*) →* core::Iterable<self::ConstIterable::expand::T*>* f) → core::Iterable<self::ConstIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::int*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::int*, core::int*) →* core::int* combine) → core::int*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::ConstIterable::fold::T* initialValue, (self::ConstIterable::fold::T*, core::int*) →* self::ConstIterable::fold::T* combine) → self::ConstIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable}) → core::List<core::int*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::int*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse}) → core::int*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse}) → core::int*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse}) → core::int*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::int*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class WithEquals extends core::Object /*hasConstConstructor*/ {
+ final field core::int* i;
+ const constructor •(core::int* i) → self::WithEquals*
+ : self::WithEquals::i = i, super core::Object::•()
+ ;
+ operator ==(core::Object* o) → core::bool*
+ ;
+ 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 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 CustomIterable extends col::IterableBase<core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::String*>*
+ ;
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::String*>* other) → core::Iterable<core::String*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::String*) →* self::CustomIterable::map::T* f) → core::Iterable<self::CustomIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::String*) →* core::Iterable<self::CustomIterable::expand::T*>* f) → core::Iterable<self::CustomIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::String*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::String*, core::String*) →* core::String* combine) → core::String*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::CustomIterable::fold::T* initialValue, (self::CustomIterable::fold::T*, core::String*) →* self::CustomIterable::fold::T* combine) → self::CustomIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable}) → core::List<core::String*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::String*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse}) → core::String*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse}) → core::String*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse}) → core::String*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::String*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class CustomMap extends core::Object implements core::Map<core::String*, core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomMap*
+ : super core::Object::•()
+ ;
+ @core::override
+ get entries() → core::Iterable<core::MapEntry<core::String*, core::String*>*>*
+ ;
+ @core::override
+ operator [](core::Object* key) → core::String*
+ ;
+ @core::override
+ operator []=(generic-covariant-impl core::String* key, generic-covariant-impl core::String* value) → void
+ ;
+ @core::override
+ method cast<RK extends core::Object* = dynamic, RV extends core::Object* = dynamic>() → core::Map<self::CustomMap::cast::RK*, self::CustomMap::cast::RV*>*
+ ;
+ @core::override
+ method clear() → void
+ ;
+ @core::override
+ method containsKey(core::Object* key) → core::bool*
+ ;
+ @core::override
+ method containsValue(core::Object* value) → core::bool*
+ ;
+ @core::override
+ get isEmpty() → core::bool*
+ ;
+ @core::override
+ get isNotEmpty() → core::bool*
+ ;
+ @core::override
+ get keys() → core::Iterable<core::String*>*
+ ;
+ @core::override
+ get length() → core::int*
+ ;
+ @core::override
+ method remove(core::Object* key) → core::String*
+ ;
+ @core::override
+ get values() → core::Iterable<core::String*>*
+ ;
+ @core::override
+ method addAll(generic-covariant-impl core::Map<core::String*, core::String*>* other) → void
+ ;
+ @core::override
+ method addEntries(generic-covariant-impl core::Iterable<core::MapEntry<core::String*, core::String*>*>* newEntries) → void
+ ;
+ @core::override
+ method forEach((core::String*, core::String*) →* void f) → void
+ ;
+ @core::override
+ method putIfAbsent(generic-covariant-impl core::String* key, generic-covariant-impl () →* core::String* ifAbsent) → core::String*
+ ;
+ @core::override
+ method updateAll(generic-covariant-impl (core::String*, core::String*) →* core::String* update) → void
+ ;
+ @core::override
+ method removeWhere((core::String*, core::String*) →* core::bool* predicate) → void
+ ;
+ method update(generic-covariant-impl core::String* key, generic-covariant-impl (core::String*) →* core::String* update, {generic-covariant-impl () →* core::String* ifAbsent}) → core::String*
+ ;
+ method map<K2 extends core::Object* = dynamic, V2 extends core::Object* = dynamic>((core::String*, core::String*) →* core::MapEntry<self::CustomMap::map::K2*, self::CustomMap::map::V2*>* f) → core::Map<self::CustomMap::map::K2*, self::CustomMap::map::V2*>*
+ ;
+ 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 core::int* fortyTwo = 42;
+static const field dynamic fortyTwoAsDynamic = (self::fortyTwo as dynamic).*(2).~/(2);
+static const field core::List<core::String*>* nullList = null;
+static const field core::List<core::String*>* foo = const <core::String*>["hello", "world"];
+static const field core::List<core::String*>* bar = self::foo + const <core::String*>["!"];
+static field core::List<core::String*>* barAsVar;
+static const field core::List<core::String*>* barWithNullSpread = self::foo + self::nullList;
+static const field core::List<core::String*>* barWithIntSpread = self::foo + const <core::String*>[invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+ ^"];
+static const field core::List<core::String*>* barWithIntDynamicSpread = self::foo + self::fortyTwoAsDynamic as{TypeError,ForDynamic} core::Iterable<dynamic>*;
+static const field core::List<core::String*>* barWithMapSpread = self::foo + const <core::String*>[invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+const List<String> barWithMapSpread = [...foo, ...quux];
+ ^"];
+static const field core::List<core::String*>* barWithCustomIterableSpread1 = self::bar + const self::CustomIterable::•();
+static const field core::List<core::String*>* barWithCustomIterableSpread2 = self::bar + const self::CustomIterable::•();
+static const field self::CustomIterable* customIterable = const self::CustomIterable::•();
+static const field core::List<core::String*>* barWithCustomIterableSpread3 = self::bar + self::customIterable;
+static const field core::List<core::String*>* listConcat = const <core::String*>["Hello"].{core::List::+}(const <core::String*>["World"]);
+static const field core::Set<core::String*>* nullSet = null;
+static const field core::Set<core::String*>* baz = const <core::String*>{"hello", "world"};
+static const field core::Set<core::String*>* qux = self::baz + const <core::String*>{"!"};
+static const field core::Set<core::String*>* quxWithNullSpread = self::baz + self::nullSet;
+static const field core::Set<core::String*>* quxWithIntSpread = self::baz + const <core::String*>{invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+ ^"};
+static const field core::Set<core::String*>* quxWithMapSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+ ^";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread1 = self::baz + const self::CustomIterable::•();
+static const field core::Set<core::String*>* quxWithCustomIterableSpread2 = self::baz + const self::CustomIterable::•();
+static const field core::Set<core::String*>* quxWithCustomIterableSpread3 = self::baz + const <core::String*>{let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+ - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+ ^" in self::customIterable as{TypeError} core::String*};
+static const field core::Set<dynamic>* setWithNonPrimitiveEquals = const <dynamic>{const self::WithEquals::•(42)};
+static const field core::Set<dynamic>* setWithDuplicates = const <dynamic>{42, 42};
+static const field core::Map<core::String*, core::String*>* nullMap = null;
+static const field core::Map<core::String*, core::String*>* quux = const <core::String*, core::String*>{"hello": "world"};
+static const field core::Map<core::String*, core::String*>* quuz = self::quux + const <core::String*, core::String*>{"!": "bye!"};
+static const field core::Map<core::String*, core::String*>* quuzWithNullSpread = self::quux + self::nullMap;
+static const field core::Map<core::String*, core::String*>* quuzWithIntSpread = self::quux + const <core::String*, core::String*>{invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+ ^": null};
+static const field core::Map<core::String*, core::String*>* quuzWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> mapWithSetSpread = {...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap1 = const self::CustomMap::•();
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap2 = const self::CustomMap::•();
+static const field core::Map<core::String*, core::String*>* customMap = const self::CustomMap::•();
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap3 = self::customMap;
+static const field core::Map<dynamic, core::int*>* mapWithNonPrimitiveEqualsKey = const <dynamic, core::int*>{const self::WithEquals::•(42): 42};
+static const field core::Map<core::int*, core::int*>* mapWithDuplicates = const <core::int*, core::int*>{42: 42, 42: 42};
+static get fooAsGetter() → core::List<core::String*>*
+ ;
+static get barAsGetter() → core::List<core::String*>*
+ ;
+static get bazAsGetter() → core::Set<core::String*>*
+ ;
+static get quxAsGetter() → core::Set<core::String*>*
+ ;
+static get quuxAsGetter() → core::Map<core::String*, core::String*>*
+ ;
+static get quuzAsGetter() → core::Map<core::String*, core::String*>*
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart.strong.expect b/pkg/front_end/testcases/general/constants/const_collections.dart.strong.expect
new file mode 100644
index 0000000..c6c94c1
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart.strong.expect
@@ -0,0 +1,517 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:40: Error: Constant evaluation error:
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:52: Context: Null value during constant evaluation.
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:20: Context: While analyzing:
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:46: Error: Constant evaluation error:
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:58: Context: Expected constant '42' to be of type 'Iterable<dynamic>', but was of type 'int'.
+// - 'Iterable' is from 'dart:core'.
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:20: Context: While analyzing:
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:26:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread1 = [
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:28:12: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// ...const CustomIterable()
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:26:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread1 = [
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:63: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:63: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:43: Error: Constant evaluation error:
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:43: Context: The method '+' can't be invoked on '<String>["Hello"]' in a constant expression.
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:20: Context: While analyzing:
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:39: Error: Constant evaluation error:
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:51: Context: Null value during constant evaluation.
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:19: Context: While analyzing:
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:43:50: Error: Constant evaluation error:
+// const Set<String> quxWithCustomIterableSpread1 = {
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:45:12: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// ...const CustomIterable()
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:43:19: Context: While analyzing:
+// const Set<String> quxWithCustomIterableSpread1 = {
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:50: Error: Constant evaluation error:
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:62: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:19: Context: While analyzing:
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:48: Error: Constant evaluation error:
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:55: Context: The element 'WithEquals {i: 42}' does not have a primitive operator '=='.
+// - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:20: Context: While analyzing:
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:40: Error: Constant evaluation error:
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:45: Context: The element '42' conflicts with another existing element in the set.
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:20: Context: While analyzing:
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:27: Error: Constant evaluation error:
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:61: Context: Null value during constant evaluation.
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:27: Context: While analyzing:
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:57: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:51: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:51: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:65:56: Error: Constant evaluation error:
+// const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:66:9: Context: The key 'WithEquals {i: 42}' does not have a primitive operator '=='.
+// - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const WithEquals(42): 42
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:65:25: Context: While analyzing:
+// const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:41: Error: Constant evaluation error:
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:50: Context: The key '42' conflicts with another existing key in the map.
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:21: Context: While analyzing:
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// const List<String> barWithMapSpread = [...foo, ...quux];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Set<String> quxWithMapSpread = {...baz, ...quux};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+// - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> mapWithSetSpread = {...baz};
+// ^
+//
+import self as self;
+import "dart:collection" as col;
+import "dart:core" as core;
+
+import "dart:collection";
+
+class ConstIterable extends col::IterableBase<core::int*> /*hasConstConstructor*/ {
+ const constructor •() → self::ConstIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::int*>*
+ return <core::int*>[].{core::Iterable::iterator};
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::int*>* other) → core::Iterable<core::int*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::int*) →* self::ConstIterable::map::T* f) → core::Iterable<self::ConstIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::int*) →* core::Iterable<self::ConstIterable::expand::T*>* f) → core::Iterable<self::ConstIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::int*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::int*, core::int*) →* core::int* combine) → core::int*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::ConstIterable::fold::T* initialValue, (self::ConstIterable::fold::T*, core::int*) →* self::ConstIterable::fold::T* combine) → self::ConstIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator = #C1]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable = #C2}) → core::List<core::int*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::int*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::int*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class WithEquals extends core::Object /*hasConstConstructor*/ {
+ final field core::int* i;
+ const constructor •(core::int* i) → self::WithEquals*
+ : self::WithEquals::i = i, super core::Object::•()
+ ;
+ operator ==(core::Object* o) → core::bool* {
+ return o is self::WithEquals* && (o{self::WithEquals*} as self::WithEquals*).{self::WithEquals::i}.{core::num::==}(this.{self::WithEquals::i});
+ }
+ 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 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 CustomIterable extends col::IterableBase<core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::String*>*
+ return <core::String*>[].{core::Iterable::iterator};
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::String*>* other) → core::Iterable<core::String*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::String*) →* self::CustomIterable::map::T* f) → core::Iterable<self::CustomIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::String*) →* core::Iterable<self::CustomIterable::expand::T*>* f) → core::Iterable<self::CustomIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::String*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::String*, core::String*) →* core::String* combine) → core::String*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::CustomIterable::fold::T* initialValue, (self::CustomIterable::fold::T*, core::String*) →* self::CustomIterable::fold::T* combine) → self::CustomIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator = #C1]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable = #C2}) → core::List<core::String*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::String*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::String*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class CustomMap extends core::Object implements core::Map<core::String*, core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomMap*
+ : super core::Object::•()
+ ;
+ @#C4
+ get entries() → core::Iterable<core::MapEntry<core::String*, core::String*>*>*
+ return <core::MapEntry<core::String*, core::String*>*>[];
+ @#C4
+ operator [](core::Object* key) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ operator []=(generic-covariant-impl core::String* key, generic-covariant-impl core::String* value) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method cast<RK extends core::Object* = dynamic, RV extends core::Object* = dynamic>() → core::Map<self::CustomMap::cast::RK*, self::CustomMap::cast::RV*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method clear() → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method containsKey(core::Object* key) → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method containsValue(core::Object* value) → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get isEmpty() → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get isNotEmpty() → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get keys() → core::Iterable<core::String*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get length() → core::int*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method remove(core::Object* key) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get values() → core::Iterable<core::String*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method addAll(generic-covariant-impl core::Map<core::String*, core::String*>* other) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method addEntries(generic-covariant-impl core::Iterable<core::MapEntry<core::String*, core::String*>*>* newEntries) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method forEach((core::String*, core::String*) →* void f) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method putIfAbsent(generic-covariant-impl core::String* key, generic-covariant-impl () →* core::String* ifAbsent) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method updateAll(generic-covariant-impl (core::String*, core::String*) →* core::String* update) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method removeWhere((core::String*, core::String*) →* core::bool* predicate) → void
+ return throw new core::UnimplementedError::•();
+ method update(generic-covariant-impl core::String* key, generic-covariant-impl (core::String*) →* core::String* update, {generic-covariant-impl () →* core::String* ifAbsent = #C3}) → core::String*
+ return throw new core::UnimplementedError::•();
+ method map<K2 extends core::Object* = dynamic, V2 extends core::Object* = dynamic>((core::String*, core::String*) →* core::MapEntry<self::CustomMap::map::K2*, self::CustomMap::map::V2*>* f) → core::Map<self::CustomMap::map::K2*, self::CustomMap::map::V2*>*
+ return throw new core::UnimplementedError::•();
+ 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 core::int* fortyTwo = #C5;
+static const field dynamic fortyTwoAsDynamic = #C5;
+static const field core::List<core::String*>* nullList = #C3;
+static const field core::List<core::String*>* foo = #C8;
+static const field core::List<core::String*>* bar = #C10;
+static field core::List<core::String*>* barAsVar = block {
+ final core::List<core::String*>* #t1 = <core::String*>[];
+ for (final core::String* #t2 in #C8)
+ #t1.{core::List::add}(#t2);
+ #t1.{core::List::add}("!");
+} =>#t1;
+static const field core::List<core::String*>* barWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::List<core::String*>* barWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+ ^";
+static const field core::List<core::String*>* barWithIntDynamicSpread = invalid-expression "Expected constant '42' to be of type 'Iterable<dynamic>', but was of type 'int'.
+ - 'Iterable' is from 'dart:core'.";
+static const field core::List<core::String*>* barWithMapSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+const List<String> barWithMapSpread = [...foo, ...quux];
+ ^";
+static const field core::List<core::String*>* barWithCustomIterableSpread1 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::List<core::String*>* barWithCustomIterableSpread2 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field self::CustomIterable* customIterable = #C11;
+static const field core::List<core::String*>* barWithCustomIterableSpread3 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::List<core::String*>* listConcat = invalid-expression "The method '+' can't be invoked on '<String>[\"Hello\"]' in a constant expression.";
+static const field core::Set<core::String*>* nullSet = #C3;
+static const field core::Set<core::String*>* baz = #C14;
+static const field core::Set<core::String*>* qux = #C17;
+static const field core::Set<core::String*>* quxWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::Set<core::String*>* quxWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+ ^";
+static const field core::Set<core::String*>* quxWithMapSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+ ^";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread1 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread2 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread3 = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+ - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+ ^";
+static const field core::Set<dynamic>* setWithNonPrimitiveEquals = invalid-expression "The element 'WithEquals {i: 42}' does not have a primitive operator '=='.
+ - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.";
+static const field core::Set<dynamic>* setWithDuplicates = invalid-expression "The element '42' conflicts with another existing element in the set.";
+static const field core::Map<core::String*, core::String*>* nullMap = #C3;
+static const field core::Map<core::String*, core::String*>* quux = #C19;
+static const field core::Map<core::String*, core::String*>* quuz = #C22;
+static const field core::Map<core::String*, core::String*>* quuzWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::Map<core::String*, core::String*>* quuzWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+ ^";
+static const field core::Map<core::String*, core::String*>* quuzWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> mapWithSetSpread = {...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap1 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap2 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<core::String*, core::String*>* customMap = #C23;
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap3 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<dynamic, core::int*>* mapWithNonPrimitiveEqualsKey = invalid-expression "The key 'WithEquals {i: 42}' does not have a primitive operator '=='.
+ - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.";
+static const field core::Map<core::int*, core::int*>* mapWithDuplicates = invalid-expression "The key '42' conflicts with another existing key in the map.";
+static get fooAsGetter() → core::List<core::String*>*
+ return #C8;
+static get barAsGetter() → core::List<core::String*>*
+ return #C10;
+static get bazAsGetter() → core::Set<core::String*>*
+ return #C14;
+static get quxAsGetter() → core::Set<core::String*>*
+ return #C17;
+static get quuxAsGetter() → core::Map<core::String*, core::String*>*
+ return #C19;
+static get quuzAsGetter() → core::Map<core::String*, core::String*>*
+ return #C22;
+static method main() → dynamic {
+ core::print(#C10);
+ core::print(#C17);
+ core::print(#C22);
+ core::print(let final core::Set<core::String*>* #t3 = col::LinkedHashSet::•<core::String*>() in let final dynamic #t4 = #t3.{core::Set::add}("hello") in #t3);
+ core::print(#C26);
+}
+
+constants {
+ #C1 = ""
+ #C2 = true
+ #C3 = null
+ #C4 = core::_Override {}
+ #C5 = 42
+ #C6 = "hello"
+ #C7 = "world"
+ #C8 = <core::String*>[#C6, #C7]
+ #C9 = "!"
+ #C10 = <core::String*>[#C6, #C7, #C9]
+ #C11 = self::CustomIterable {}
+ #C12 = <dynamic>[#C6, #C3, #C7, #C3]
+ #C13 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C12}
+ #C14 = col::_UnmodifiableSet<core::String*> {_map:#C13}
+ #C15 = <dynamic>[#C6, #C3, #C7, #C3, #C9, #C3]
+ #C16 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C15}
+ #C17 = col::_UnmodifiableSet<core::String*> {_map:#C16}
+ #C18 = <dynamic>[#C6, #C7]
+ #C19 = core::_ImmutableMap<core::String*, core::String*> {_kvPairs:#C18}
+ #C20 = "bye!"
+ #C21 = <dynamic>[#C6, #C7, #C9, #C20]
+ #C22 = core::_ImmutableMap<core::String*, core::String*> {_kvPairs:#C21}
+ #C23 = self::CustomMap {}
+ #C24 = <dynamic>[#C6, #C3]
+ #C25 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C24}
+ #C26 = col::_UnmodifiableSet<core::String*> {_map:#C25}
+}
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/const_collections.dart.strong.transformed.expect
new file mode 100644
index 0000000..0bbe0da
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart.strong.transformed.expect
@@ -0,0 +1,522 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:40: Error: Constant evaluation error:
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:52: Context: Null value during constant evaluation.
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:22:20: Context: While analyzing:
+// const List<String> barWithNullSpread = [...foo, ...nullList];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:46: Error: Constant evaluation error:
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:58: Context: Expected constant '42' to be of type 'Iterable<dynamic>', but was of type 'int'.
+// - 'Iterable' is from 'dart:core'.
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:24:20: Context: While analyzing:
+// const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:26:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread1 = [
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:28:12: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// ...const CustomIterable()
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:26:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread1 = [
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:63: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:30:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:51: Error: Constant evaluation error:
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:63: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:32:20: Context: While analyzing:
+// const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:43: Error: Constant evaluation error:
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:43: Context: The method '+' can't be invoked on '<String>["Hello"]' in a constant expression.
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:33:20: Context: While analyzing:
+// const List<String> listConcat = ["Hello"] + ["World"];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:39: Error: Constant evaluation error:
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:51: Context: Null value during constant evaluation.
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:40:19: Context: While analyzing:
+// const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:43:50: Error: Constant evaluation error:
+// const Set<String> quxWithCustomIterableSpread1 = {
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:45:12: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// ...const CustomIterable()
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:43:19: Context: While analyzing:
+// const Set<String> quxWithCustomIterableSpread1 = {
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:50: Error: Constant evaluation error:
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:62: Context: Only lists and sets can be used in spreads in constant lists and sets.
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:47:19: Context: While analyzing:
+// const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:48: Error: Constant evaluation error:
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:55: Context: The element 'WithEquals {i: 42}' does not have a primitive operator '=='.
+// - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:49:20: Context: While analyzing:
+// const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:40: Error: Constant evaluation error:
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:45: Context: The element '42' conflicts with another existing element in the set.
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:50:20: Context: While analyzing:
+// const Set<dynamic> setWithDuplicates = {42, 42};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:27: Error: Constant evaluation error:
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:61: Context: Null value during constant evaluation.
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:57:27: Context: While analyzing:
+// const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:57: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:61:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:51: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:62:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:27: Error: Constant evaluation error:
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:51: Context: Only maps can be used in spreads in constant maps.
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:64:27: Context: While analyzing:
+// const Map<String, String> mapWithCustomMap3 = {...customMap};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:65:56: Error: Constant evaluation error:
+// const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:66:9: Context: The key 'WithEquals {i: 42}' does not have a primitive operator '=='.
+// - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const WithEquals(42): 42
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:65:25: Context: While analyzing:
+// const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:41: Error: Constant evaluation error:
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:50: Context: The key '42' conflicts with another existing key in the map.
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+// pkg/front_end/testcases/general/constants/const_collections.dart:68:21: Context: While analyzing:
+// const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+// const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+// - 'Map' is from 'dart:core'.
+// const List<String> barWithMapSpread = [...foo, ...quux];
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+// const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Set<String> quxWithMapSpread = {...baz, ...quux};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+// - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+// const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+// const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+// ^
+//
+// pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+// const Map<String, String> mapWithSetSpread = {...baz};
+// ^
+//
+import self as self;
+import "dart:collection" as col;
+import "dart:core" as core;
+
+import "dart:collection";
+
+class ConstIterable extends col::IterableBase<core::int*> /*hasConstConstructor*/ {
+ const constructor •() → self::ConstIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::int*>*
+ return <core::int*>[].{core::Iterable::iterator};
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::int*>* other) → core::Iterable<core::int*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::int*) →* self::ConstIterable::map::T* f) → core::Iterable<self::ConstIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::ConstIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::int*) →* core::Iterable<self::ConstIterable::expand::T*>* f) → core::Iterable<self::ConstIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::int*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::int*, core::int*) →* core::int* combine) → core::int*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::ConstIterable::fold::T* initialValue, (self::ConstIterable::fold::T*, core::int*) →* self::ConstIterable::fold::T* combine) → self::ConstIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator = #C1]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::int*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable = #C2}) → core::List<core::int*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::int*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::int*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::int*) →* core::bool* test) → core::Iterable<core::int*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::int*) →* core::bool* test, {generic-covariant-impl () →* core::int* orElse = #C3}) → core::int*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::int*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class WithEquals extends core::Object /*hasConstConstructor*/ {
+ final field core::int* i;
+ const constructor •(core::int* i) → self::WithEquals*
+ : self::WithEquals::i = i, super core::Object::•()
+ ;
+ operator ==(core::Object* o) → core::bool* {
+ return o is self::WithEquals* && o{self::WithEquals*}.{self::WithEquals::i}.{core::num::==}(this.{self::WithEquals::i});
+ }
+ 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 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 CustomIterable extends col::IterableBase<core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomIterable*
+ : super col::IterableBase::•()
+ ;
+ get iterator() → core::Iterator<core::String*>*
+ return <core::String*>[].{core::Iterable::iterator};
+ abstract member-signature method cast<R extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::cast::R*>*; -> core::Iterable::cast
+ abstract member-signature method followedBy(generic-covariant-impl core::Iterable<core::String*>* other) → core::Iterable<core::String*>*; -> core::Iterable::followedBy
+ abstract member-signature method map<T extends core::Object* = dynamic>((core::String*) →* self::CustomIterable::map::T* f) → core::Iterable<self::CustomIterable::map::T*>*; -> core::Iterable::map
+ abstract member-signature method where((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::where
+ abstract member-signature method whereType<T extends core::Object* = dynamic>() → core::Iterable<self::CustomIterable::whereType::T*>*; -> core::Iterable::whereType
+ abstract member-signature method expand<T extends core::Object* = dynamic>((core::String*) →* core::Iterable<self::CustomIterable::expand::T*>* f) → core::Iterable<self::CustomIterable::expand::T*>*; -> core::Iterable::expand
+ abstract member-signature method contains(core::Object* element) → core::bool*; -> core::Iterable::contains
+ abstract member-signature method forEach((core::String*) →* void f) → void; -> core::Iterable::forEach
+ abstract member-signature method reduce(generic-covariant-impl (core::String*, core::String*) →* core::String* combine) → core::String*; -> core::Iterable::reduce
+ abstract member-signature method fold<T extends core::Object* = dynamic>(self::CustomIterable::fold::T* initialValue, (self::CustomIterable::fold::T*, core::String*) →* self::CustomIterable::fold::T* combine) → self::CustomIterable::fold::T*; -> core::Iterable::fold
+ abstract member-signature method every((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::every
+ abstract member-signature method join([core::String* separator = #C1]) → core::String*; -> core::Iterable::join
+ abstract member-signature method any((core::String*) →* core::bool* test) → core::bool*; -> core::Iterable::any
+ abstract member-signature method toList({core::bool* growable = #C2}) → core::List<core::String*>*; -> core::Iterable::toList
+ abstract member-signature method toSet() → core::Set<core::String*>*; -> core::Iterable::toSet
+ abstract member-signature get length() → core::int*; -> core::Iterable::length
+ abstract member-signature get isEmpty() → core::bool*; -> core::Iterable::isEmpty
+ abstract member-signature get isNotEmpty() → core::bool*; -> core::Iterable::isNotEmpty
+ abstract member-signature method take(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::take
+ abstract member-signature method takeWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::takeWhile
+ abstract member-signature method skip(core::int* count) → core::Iterable<core::String*>*; -> core::Iterable::skip
+ abstract member-signature method skipWhile((core::String*) →* core::bool* test) → core::Iterable<core::String*>*; -> core::Iterable::skipWhile
+ abstract member-signature method firstWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::firstWhere
+ abstract member-signature method lastWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::lastWhere
+ abstract member-signature method singleWhere((core::String*) →* core::bool* test, {generic-covariant-impl () →* core::String* orElse = #C3}) → core::String*; -> core::Iterable::singleWhere
+ abstract member-signature method elementAt(core::int* index) → core::String*; -> core::Iterable::elementAt
+ abstract member-signature method toString() → core::String*; -> core::Iterable::toString
+ 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 noSuchMethod(core::Invocation* invocation) → dynamic; -> core::Object::noSuchMethod
+ abstract member-signature get runtimeType() → core::Type*; -> core::Object::runtimeType
+}
+class CustomMap extends core::Object implements core::Map<core::String*, core::String*> /*hasConstConstructor*/ {
+ const constructor •() → self::CustomMap*
+ : super core::Object::•()
+ ;
+ @#C4
+ get entries() → core::Iterable<core::MapEntry<core::String*, core::String*>*>*
+ return <core::MapEntry<core::String*, core::String*>*>[];
+ @#C4
+ operator [](core::Object* key) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ operator []=(generic-covariant-impl core::String* key, generic-covariant-impl core::String* value) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method cast<RK extends core::Object* = dynamic, RV extends core::Object* = dynamic>() → core::Map<self::CustomMap::cast::RK*, self::CustomMap::cast::RV*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method clear() → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method containsKey(core::Object* key) → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method containsValue(core::Object* value) → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get isEmpty() → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get isNotEmpty() → core::bool*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get keys() → core::Iterable<core::String*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get length() → core::int*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method remove(core::Object* key) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ get values() → core::Iterable<core::String*>*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method addAll(generic-covariant-impl core::Map<core::String*, core::String*>* other) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method addEntries(generic-covariant-impl core::Iterable<core::MapEntry<core::String*, core::String*>*>* newEntries) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method forEach((core::String*, core::String*) →* void f) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method putIfAbsent(generic-covariant-impl core::String* key, generic-covariant-impl () →* core::String* ifAbsent) → core::String*
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method updateAll(generic-covariant-impl (core::String*, core::String*) →* core::String* update) → void
+ return throw new core::UnimplementedError::•();
+ @#C4
+ method removeWhere((core::String*, core::String*) →* core::bool* predicate) → void
+ return throw new core::UnimplementedError::•();
+ method update(generic-covariant-impl core::String* key, generic-covariant-impl (core::String*) →* core::String* update, {generic-covariant-impl () →* core::String* ifAbsent = #C3}) → core::String*
+ return throw new core::UnimplementedError::•();
+ method map<K2 extends core::Object* = dynamic, V2 extends core::Object* = dynamic>((core::String*, core::String*) →* core::MapEntry<self::CustomMap::map::K2*, self::CustomMap::map::V2*>* f) → core::Map<self::CustomMap::map::K2*, self::CustomMap::map::V2*>*
+ return throw new core::UnimplementedError::•();
+ 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 core::int* fortyTwo = #C5;
+static const field dynamic fortyTwoAsDynamic = #C5;
+static const field core::List<core::String*>* nullList = #C3;
+static const field core::List<core::String*>* foo = #C8;
+static const field core::List<core::String*>* bar = #C10;
+static field core::List<core::String*>* barAsVar = block {
+ final core::List<core::String*>* #t1 = <core::String*>[];
+ {
+ core::Iterator<core::String*>* :sync-for-iterator = (#C8).{core::Iterable::iterator};
+ for (; :sync-for-iterator.{core::Iterator::moveNext}(); ) {
+ final core::String* #t2 = :sync-for-iterator.{core::Iterator::current};
+ #t1.{core::List::add}(#t2);
+ }
+ }
+ #t1.{core::List::add}("!");
+} =>#t1;
+static const field core::List<core::String*>* barWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::List<core::String*>* barWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:23:51: Error: Unexpected type 'int' of a spread. Expected 'dynamic' or an Iterable.
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+ ^";
+static const field core::List<core::String*>* barWithIntDynamicSpread = invalid-expression "Expected constant '42' to be of type 'Iterable<dynamic>', but was of type 'int'.
+ - 'Iterable' is from 'dart:core'.";
+static const field core::List<core::String*>* barWithMapSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:25:51: Error: Unexpected type 'Map<String, String>' of a spread. Expected 'dynamic' or an Iterable.
+ - 'Map' is from 'dart:core'.
+const List<String> barWithMapSpread = [...foo, ...quux];
+ ^";
+static const field core::List<core::String*>* barWithCustomIterableSpread1 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::List<core::String*>* barWithCustomIterableSpread2 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field self::CustomIterable* customIterable = #C11;
+static const field core::List<core::String*>* barWithCustomIterableSpread3 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::List<core::String*>* listConcat = invalid-expression "The method '+' can't be invoked on '<String>[\"Hello\"]' in a constant expression.";
+static const field core::Set<core::String*>* nullSet = #C3;
+static const field core::Set<core::String*>* baz = #C14;
+static const field core::Set<core::String*>* qux = #C17;
+static const field core::Set<core::String*>* quxWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::Set<core::String*>* quxWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:41:50: Error: Expected ',' before this.
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+ ^";
+static const field core::Set<core::String*>* quxWithMapSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:42:38: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+ ^";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread1 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread2 = invalid-expression "Only lists and sets can be used in spreads in constant lists and sets.";
+static const field core::Set<core::String*>* quxWithCustomIterableSpread3 = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:48:59: Error: A value of type 'CustomIterable' can't be assigned to a variable of type 'String'.
+ - 'CustomIterable' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+ ^";
+static const field core::Set<dynamic>* setWithNonPrimitiveEquals = invalid-expression "The element 'WithEquals {i: 42}' does not have a primitive operator '=='.
+ - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.";
+static const field core::Set<dynamic>* setWithDuplicates = invalid-expression "The element '42' conflicts with another existing element in the set.";
+static const field core::Map<core::String*, core::String*>* nullMap = #C3;
+static const field core::Map<core::String*, core::String*>* quux = #C19;
+static const field core::Map<core::String*, core::String*>* quuz = #C22;
+static const field core::Map<core::String*, core::String*>* quuzWithNullSpread = invalid-expression "Null value during constant evaluation.";
+static const field core::Map<core::String*, core::String*>* quuzWithIntSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:58:60: Error: Unexpected type 'int' of a map spread entry. Expected 'dynamic' or a Map.
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+ ^";
+static const field core::Map<core::String*, core::String*>* quuzWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:59:47: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithSetSpread = invalid-expression "pkg/front_end/testcases/general/constants/const_collections.dart:60:46: Error: Both Iterable and Map spread elements encountered in ambiguous literal.
+const Map<String, String> mapWithSetSpread = {...baz};
+ ^";
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap1 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap2 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<core::String*, core::String*>* customMap = #C23;
+static const field core::Map<core::String*, core::String*>* mapWithCustomMap3 = invalid-expression "Only maps can be used in spreads in constant maps.";
+static const field core::Map<dynamic, core::int*>* mapWithNonPrimitiveEqualsKey = invalid-expression "The key 'WithEquals {i: 42}' does not have a primitive operator '=='.
+ - 'WithEquals' is from 'pkg/front_end/testcases/general/constants/const_collections.dart'.";
+static const field core::Map<core::int*, core::int*>* mapWithDuplicates = invalid-expression "The key '42' conflicts with another existing key in the map.";
+static get fooAsGetter() → core::List<core::String*>*
+ return #C8;
+static get barAsGetter() → core::List<core::String*>*
+ return #C10;
+static get bazAsGetter() → core::Set<core::String*>*
+ return #C14;
+static get quxAsGetter() → core::Set<core::String*>*
+ return #C17;
+static get quuxAsGetter() → core::Map<core::String*, core::String*>*
+ return #C19;
+static get quuzAsGetter() → core::Map<core::String*, core::String*>*
+ return #C22;
+static method main() → dynamic {
+ core::print(#C10);
+ core::print(#C17);
+ core::print(#C22);
+ core::print(let final core::Set<core::String*>* #t3 = new col::_CompactLinkedHashSet::•<core::String*>() in let final core::bool #t4 = #t3.{core::Set::add}("hello") in #t3);
+ core::print(#C26);
+}
+
+constants {
+ #C1 = ""
+ #C2 = true
+ #C3 = null
+ #C4 = core::_Override {}
+ #C5 = 42
+ #C6 = "hello"
+ #C7 = "world"
+ #C8 = <core::String*>[#C6, #C7]
+ #C9 = "!"
+ #C10 = <core::String*>[#C6, #C7, #C9]
+ #C11 = self::CustomIterable {}
+ #C12 = <dynamic>[#C6, #C3, #C7, #C3]
+ #C13 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C12}
+ #C14 = col::_UnmodifiableSet<core::String*> {_map:#C13}
+ #C15 = <dynamic>[#C6, #C3, #C7, #C3, #C9, #C3]
+ #C16 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C15}
+ #C17 = col::_UnmodifiableSet<core::String*> {_map:#C16}
+ #C18 = <dynamic>[#C6, #C7]
+ #C19 = core::_ImmutableMap<core::String*, core::String*> {_kvPairs:#C18}
+ #C20 = "bye!"
+ #C21 = <dynamic>[#C6, #C7, #C9, #C20]
+ #C22 = core::_ImmutableMap<core::String*, core::String*> {_kvPairs:#C21}
+ #C23 = self::CustomMap {}
+ #C24 = <dynamic>[#C6, #C3]
+ #C25 = core::_ImmutableMap<core::String*, core::Null?> {_kvPairs:#C24}
+ #C26 = col::_UnmodifiableSet<core::String*> {_map:#C25}
+}
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline.expect
new file mode 100644
index 0000000..1b2ee83
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline.expect
@@ -0,0 +1,124 @@
+import 'dart:collection';
+
+class ConstIterable extends IterableBase<int> {
+ const ConstIterable();
+ Iterator<int> get iterator => <int>[].iterator;
+}
+
+const int fortyTwo = 42;
+const dynamic fortyTwoAsDynamic = ((fortyTwo as dynamic) * 2) ~/ 2;
+const List<String> nullList = null;
+const List<String> foo = ["hello", "world"];
+List<String> get fooAsGetter => const ["hello", "world"];
+const List<String> bar = [...foo, "!"];
+var barAsVar = [...foo, "!"];
+List<String> get barAsGetter => const [...foo, "!"];
+const List<String> barWithNullSpread = [...foo, ...nullList];
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+const List<String> barWithMapSpread = [...foo, ...quux];
+const List<String> barWithCustomIterableSpread1 = [
+ ...bar,
+ ...const CustomIterable()
+];
+const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+const customIterable = const CustomIterable();
+const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+const List<String> listConcat = ["Hello"] + ["World"];
+const Set<String> nullSet = null;
+const Set<String> baz = {"hello", "world"};
+Set<String> get bazAsGetter => const {"hello", "world"};
+const Set<String> qux = {...baz, "!"};
+Set<String> get quxAsGetter => const {...baz, "!"};
+const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+const Set<String> quxWithCustomIterableSpread1 = {
+ ...baz,
+ ...const CustomIterable()
+};
+const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+const Set<dynamic> setWithDuplicates = {42, 42};
+const Map<String, String> nullMap = null;
+const Map<String, String> quux = {"hello": "world"};
+Map<String, String> get quuxAsGetter => const {"hello": "world"};
+const Map<String, String> quuz = {...quux, "!": "bye!"};
+Map<String, String> get quuzAsGetter => const {...quux, "!": "bye!"};
+const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+const Map<String, String> mapWithSetSpread = {...baz};
+const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+const Map<String, String> customMap = const CustomMap();
+const Map<String, String> mapWithCustomMap3 = {...customMap};
+const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+ const WithEquals(42): 42
+};
+const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+
+class WithEquals {
+ final int i;
+ const WithEquals(this.i);
+ operator ==(Object o) {}
+}
+
+class CustomIterable extends IterableBase<String> {
+ const CustomIterable();
+ Iterator<String> get iterator => <String>[].iterator;
+}
+
+class CustomMap implements Map<String, String> {
+ const CustomMap();
+ @override
+ Iterable<MapEntry<String, String>> get entries => [];
+ @override
+ String operator [](Object key) => throw new UnimplementedError();
+ @override
+ void operator []=(String key, String value) => throw new UnimplementedError();
+ @override
+ Map<RK, RV> cast<RK, RV>() => throw new UnimplementedError();
+ @override
+ void clear() => throw new UnimplementedError();
+ @override
+ bool containsKey(Object key) => throw new UnimplementedError();
+ @override
+ bool containsValue(Object value) => throw new UnimplementedError();
+ @override
+ bool get isEmpty => throw new UnimplementedError();
+ @override
+ bool get isNotEmpty => throw new UnimplementedError();
+ @override
+ Iterable<String> get keys => throw new UnimplementedError();
+ @override
+ int get length => throw new UnimplementedError();
+ @override
+ String remove(Object key) => throw new UnimplementedError();
+ @override
+ Iterable<String> get values => throw new UnimplementedError();
+ @override
+ void addAll(Map<String, String> other) => throw new UnimplementedError();
+ @override
+ void addEntries(Iterable<MapEntry<String, String>> newEntries) =>
+ throw new UnimplementedError();
+ @override
+ void forEach(void f(String key, String value)) =>
+ throw new UnimplementedError();
+ @override
+ String putIfAbsent(String key, String ifAbsent()) =>
+ throw new UnimplementedError();
+ @override
+ void updateAll(String update(String key, String value)) =>
+ throw new UnimplementedError();
+ @override
+ void removeWhere(bool predicate(String key, String value)) =>
+ throw new UnimplementedError();
+ String update(String key, String update(String value), {String ifAbsent()}) =>
+ throw new UnimplementedError();
+ Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> f(String key, String value)) =>
+ throw new UnimplementedError();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..97ae580
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/const_collections.dart.textual_outline_modelled.expect
@@ -0,0 +1,124 @@
+import 'dart:collection';
+
+List<String> get barAsGetter => const [...foo, "!"];
+List<String> get fooAsGetter => const ["hello", "world"];
+Map<String, String> get quuxAsGetter => const {"hello": "world"};
+Map<String, String> get quuzAsGetter => const {...quux, "!": "bye!"};
+Set<String> get bazAsGetter => const {"hello", "world"};
+Set<String> get quxAsGetter => const {...baz, "!"};
+
+class ConstIterable extends IterableBase<int> {
+ Iterator<int> get iterator => <int>[].iterator;
+ const ConstIterable();
+}
+
+class CustomIterable extends IterableBase<String> {
+ Iterator<String> get iterator => <String>[].iterator;
+ const CustomIterable();
+}
+
+class CustomMap implements Map<String, String> {
+ @override
+ Iterable<MapEntry<String, String>> get entries => [];
+ @override
+ Iterable<String> get keys => throw new UnimplementedError();
+ @override
+ Iterable<String> get values => throw new UnimplementedError();
+ Map<K2, V2> map<K2, V2>(MapEntry<K2, V2> f(String key, String value)) =>
+ throw new UnimplementedError();
+ @override
+ Map<RK, RV> cast<RK, RV>() => throw new UnimplementedError();
+ @override
+ String operator [](Object key) => throw new UnimplementedError();
+ @override
+ String putIfAbsent(String key, String ifAbsent()) =>
+ throw new UnimplementedError();
+ @override
+ String remove(Object key) => throw new UnimplementedError();
+ String update(String key, String update(String value), {String ifAbsent()}) =>
+ throw new UnimplementedError();
+ @override
+ bool containsKey(Object key) => throw new UnimplementedError();
+ @override
+ bool containsValue(Object value) => throw new UnimplementedError();
+ @override
+ bool get isEmpty => throw new UnimplementedError();
+ @override
+ bool get isNotEmpty => throw new UnimplementedError();
+ const CustomMap();
+ @override
+ int get length => throw new UnimplementedError();
+ @override
+ void addAll(Map<String, String> other) => throw new UnimplementedError();
+ @override
+ void addEntries(Iterable<MapEntry<String, String>> newEntries) =>
+ throw new UnimplementedError();
+ @override
+ void clear() => throw new UnimplementedError();
+ @override
+ void forEach(void f(String key, String value)) =>
+ throw new UnimplementedError();
+ @override
+ void operator []=(String key, String value) => throw new UnimplementedError();
+ @override
+ void removeWhere(bool predicate(String key, String value)) =>
+ throw new UnimplementedError();
+ @override
+ void updateAll(String update(String key, String value)) =>
+ throw new UnimplementedError();
+}
+
+class WithEquals {
+ const WithEquals(this.i);
+ final int i;
+ operator ==(Object o) {}
+}
+
+const List<String> bar = [...foo, "!"];
+const List<String> barWithCustomIterableSpread1 = [
+ ...bar,
+ ...const CustomIterable()
+];
+const List<String> barWithCustomIterableSpread2 = [...bar, ...CustomIterable()];
+const List<String> barWithCustomIterableSpread3 = [...bar, ...customIterable];
+const List<String> barWithIntDynamicSpread = [...foo, ...fortyTwoAsDynamic];
+const List<String> barWithIntSpread = [...foo, ...fortyTwo];
+const List<String> barWithMapSpread = [...foo, ...quux];
+const List<String> barWithNullSpread = [...foo, ...nullList];
+const List<String> foo = ["hello", "world"];
+const List<String> listConcat = ["Hello"] + ["World"];
+const List<String> nullList = null;
+const Map<String, String> customMap = const CustomMap();
+const Map<String, String> mapWithCustomMap1 = {...const CustomMap()};
+const Map<String, String> mapWithCustomMap2 = {...CustomMap()};
+const Map<String, String> mapWithCustomMap3 = {...customMap};
+const Map<String, String> mapWithSetSpread = {...baz};
+const Map<String, String> nullMap = null;
+const Map<String, String> quux = {"hello": "world"};
+const Map<String, String> quuz = {...quux, "!": "bye!"};
+const Map<String, String> quuzWithIntSpread = {...quux, ...fortyTwo};
+const Map<String, String> quuzWithNullSpread = {...quux, ...nullMap};
+const Map<String, String> quuzWithSetSpread = {...quux, ...baz};
+const Map<dynamic, int> mapWithNonPrimitiveEqualsKey = {
+ const WithEquals(42): 42
+};
+const Map<int, int> mapWithDuplicates = {42: 42, 42: 42};
+const Set<String> baz = {"hello", "world"};
+const Set<String> nullSet = null;
+const Set<String> qux = {...baz, "!"};
+const Set<String> quxWithCustomIterableSpread1 = {
+ ...baz,
+ ...const CustomIterable()
+};
+const Set<String> quxWithCustomIterableSpread2 = {...baz, ...CustomIterable()};
+const Set<String> quxWithCustomIterableSpread3 = {...baz, customIterable};
+const Set<String> quxWithIntSpread = {...baz, ...fortyTwo};
+const Set<String> quxWithMapSpread = {...baz, ...quux};
+const Set<String> quxWithNullSpread = {...baz, ...nullSet};
+const Set<dynamic> setWithDuplicates = {42, 42};
+const Set<dynamic> setWithNonPrimitiveEquals = {const WithEquals(42)};
+const customIterable = const CustomIterable();
+const dynamic fortyTwoAsDynamic = ((fortyTwo as dynamic) * 2) ~/ 2;
+const int fortyTwo = 42;
+main() {}
+var barAsVar = [...foo, "!"];
diff --git a/pkg/front_end/testcases/general/constants/folder.options b/pkg/front_end/testcases/general/constants/folder.options
new file mode 100644
index 0000000..0cbe954
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/folder.options
@@ -0,0 +1,4 @@
+--enable-experiment=triple-shift
+-Dbaz=42
+-DbazTrue=true
+-DbazFalse=false
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/folder.options b/pkg/front_end/testcases/general/constants/js_semantics/folder.options
new file mode 100644
index 0000000..674c362
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/folder.options
@@ -0,0 +1,2 @@
+--enable-experiment=triple-shift
+--target=noneWithJs
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart
new file mode 100644
index 0000000..618b0a5
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int shiftNegative1 = 2 << -1;
+const int shiftNegative2 = 2 >>> -1;
+const int shiftNegative3 = 2 >> -1;
+const int modZero = 2 % 0;
+const int divZero = 2 / 0;
+const int intdivZero = 2 ~/ 0;
+const int unaryMinus = -2;
+const int unaryTilde = ~2;
+const int unaryPlus = +2;
+
+const int binaryPlus = 40 + 2;
+const int binaryMinus = 44 - 2;
+const int binaryTimes = 21 * 2;
+const double binaryDiv = 84 / 2;
+const int binaryTildeDiv = 84~/ 2;
+const int binaryMod = 85 % 43;
+const int binaryOr = 32 | 10;
+const int binaryAnd = 63 & 106;
+const int binaryXor = 63 ^ 21;
+const int binaryShift1 = 21 << 1;
+
+// These aren't currently defined on int :(.
+const int binaryShift2 = 84 >>> 1;
+const int binaryShift3 = 21 >>> 64;
+
+const int binaryShift4 = 84 >> 1;
+const int binaryShift5 = -1 >> 1;
+const bool binaryLess = 42 < 42;
+const bool binaryLessEqual = 42 <= 42;
+const bool binaryGreaterEqual = 42 >= 42;
+const bool binaryGreater = 42 > 42;
+
+const int doubleTruncateDiv = 84.2 ~/ 2;
+const int doubleTruncateDivZero = 84.2 ~/ 0;
+const int doubleTruncateDivNull = 84.2 ~/ null;
+const double doubleNan = 0/0;
+const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+
+const int bigNumber = 0x8000000000000000;
+
+main() {
+
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.outline.expect
new file mode 100644
index 0000000..abddda5
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.outline.expect
@@ -0,0 +1,79 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}());
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}());
+static const field core::int* modZero = 2.{core::num::%}(0);
+static const field core::int* divZero = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^" in 2.{core::num::/}(0) as{TypeError} core::int*;
+static const field core::int* intdivZero = 2.{core::num::~/}(0);
+static const field core::int* unaryMinus = 2.{core::int::unary-}();
+static const field core::int* unaryTilde = 2.{core::int::~}();
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^".+(2) as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryPlus = 40.{core::num::+}(2);
+static const field core::int* binaryMinus = 44.{core::num::-}(2);
+static const field core::int* binaryTimes = 21.{core::num::*}(2);
+static const field core::double* binaryDiv = 84.{core::num::/}(2);
+static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2);
+static const field core::int* binaryMod = 85.{core::num::%}(43);
+static const field core::int* binaryOr = 32.{core::int::|}(10);
+static const field core::int* binaryAnd = 63.{core::int::&}(106);
+static const field core::int* binaryXor = 63.{core::int::^}(21);
+static const field core::int* binaryShift1 = 21.{core::int::<<}(1);
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryShift4 = 84.{core::int::>>}(1);
+static const field core::int* binaryShift5 = 1.{core::int::unary-}().{core::int::>>}(1);
+static const field core::bool* binaryLess = 42.{core::num::<}(42);
+static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42);
+static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42);
+static const field core::bool* binaryGreater = 42.{core::num::>}(42);
+static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2);
+static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0);
+static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null);
+static const field core::double* doubleNan = 0.{core::num::/}(0);
+static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan);
+static const field core::int* bigNumber = -9223372036854775808;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.expect
new file mode 100644
index 0000000..351a41d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.expect
@@ -0,0 +1,162 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:30: Error: Constant evaluation error:
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:30: Context: Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'.
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:11: Context: While analyzing:
+// const int shiftNegative1 = 2 << -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:30: Error: Constant evaluation error:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:30: Context: Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'.
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:11: Context: While analyzing:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:23: Error: Constant evaluation error:
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:23: Context: Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'.
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:11: Context: While analyzing:
+// const int modZero = 2 % 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:26: Error: Constant evaluation error:
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:26: Context: Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'.
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:11: Context: While analyzing:
+// const int intdivZero = 2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Error: Constant evaluation error:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:11: Context: While analyzing:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Error: Constant evaluation error:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:11: Context: While analyzing:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Error: Constant evaluation error:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN.
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:11: Context: While analyzing:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'.";
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^";
+static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'.";
+static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^";
+static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* unaryMinus = #C1;
+static const field core::int* unaryTilde = #C2;
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^";
+static const field core::int* binaryPlus = #C3;
+static const field core::int* binaryMinus = #C3;
+static const field core::int* binaryTimes = #C3;
+static const field core::double* binaryDiv = #C3;
+static const field core::int* binaryTildeDiv = #C3;
+static const field core::int* binaryMod = #C3;
+static const field core::int* binaryOr = #C3;
+static const field core::int* binaryAnd = #C3;
+static const field core::int* binaryXor = #C3;
+static const field core::int* binaryShift1 = #C3;
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^";
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^";
+static const field core::int* binaryShift4 = #C3;
+static const field core::int* binaryShift5 = #C4;
+static const field core::bool* binaryLess = #C5;
+static const field core::bool* binaryLessEqual = #C6;
+static const field core::bool* binaryGreaterEqual = #C6;
+static const field core::bool* binaryGreater = #C5;
+static const field core::int* doubleTruncateDiv = #C3;
+static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.";
+static const field core::double* doubleNan = #C7;
+static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN.";
+static const field core::int* bigNumber = #C8;
+static method main() → dynamic {}
+
+constants {
+ #C1 = -2.0
+ #C2 = 4294967293.0
+ #C3 = 42.0
+ #C4 = 4294967295.0
+ #C5 = false
+ #C6 = true
+ #C7 = NaN
+ #C8 = 9223372036854776000.0
+}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.transformed.expect
new file mode 100644
index 0000000..351a41d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.strong.transformed.expect
@@ -0,0 +1,162 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:30: Error: Constant evaluation error:
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:30: Context: Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'.
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:5:11: Context: While analyzing:
+// const int shiftNegative1 = 2 << -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:30: Error: Constant evaluation error:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:30: Context: Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'.
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:7:11: Context: While analyzing:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:23: Error: Constant evaluation error:
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:23: Context: Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'.
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:8:11: Context: While analyzing:
+// const int modZero = 2 % 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:26: Error: Constant evaluation error:
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:26: Context: Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'.
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:10:11: Context: While analyzing:
+// const int intdivZero = 2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Error: Constant evaluation error:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:38:11: Context: While analyzing:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Error: Constant evaluation error:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:39:11: Context: While analyzing:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Error: Constant evaluation error:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN.
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:41:11: Context: While analyzing:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2.0' requires non-negative operand, but was '-1.0'.";
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^";
+static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2.0' requires non-negative operand, but was '-1.0'.";
+static const field core::int* modZero = invalid-expression "Binary operator '%' on '2.0' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^";
+static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2.0' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* unaryMinus = #C1;
+static const field core::int* unaryTilde = #C2;
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^";
+static const field core::int* binaryPlus = #C3;
+static const field core::int* binaryMinus = #C3;
+static const field core::int* binaryTimes = #C3;
+static const field core::double* binaryDiv = #C3;
+static const field core::int* binaryTildeDiv = #C3;
+static const field core::int* binaryMod = #C3;
+static const field core::int* binaryOr = #C3;
+static const field core::int* binaryAnd = #C3;
+static const field core::int* binaryXor = #C3;
+static const field core::int* binaryShift1 = #C3;
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^";
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^";
+static const field core::int* binaryShift4 = #C3;
+static const field core::int* binaryShift5 = #C4;
+static const field core::bool* binaryLess = #C5;
+static const field core::bool* binaryLessEqual = #C6;
+static const field core::bool* binaryGreaterEqual = #C6;
+static const field core::bool* binaryGreater = #C5;
+static const field core::int* doubleTruncateDiv = #C3;
+static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.";
+static const field core::double* doubleNan = #C7;
+static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN.";
+static const field core::int* bigNumber = #C8;
+static method main() → dynamic {}
+
+constants {
+ #C1 = -2.0
+ #C2 = 4294967293.0
+ #C3 = 42.0
+ #C4 = 4294967295.0
+ #C5 = false
+ #C6 = true
+ #C7 = NaN
+ #C8 = 9223372036854776000.0
+}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect
new file mode 100644
index 0000000..cb5607d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/number_folds.dart.textual_outline.expect
@@ -0,0 +1,34 @@
+const int shiftNegative1 = 2 << -1;
+const int shiftNegative2 = 2 >>> -1;
+const int shiftNegative3 = 2 >> -1;
+const int modZero = 2 % 0;
+const int divZero = 2 / 0;
+const int intdivZero = 2 ~/ 0;
+const int unaryMinus = -2;
+const int unaryTilde = ~2;
+const int unaryPlus = +2;
+const int binaryPlus = 40 + 2;
+const int binaryMinus = 44 - 2;
+const int binaryTimes = 21 * 2;
+const double binaryDiv = 84 / 2;
+const int binaryTildeDiv = 84~/ 2;
+const int binaryMod = 85 % 43;
+const int binaryOr = 32 | 10;
+const int binaryAnd = 63 & 106;
+const int binaryXor = 63 ^ 21;
+const int binaryShift1 = 21 << 1;
+const int binaryShift2 = 84 >>> 1;
+const int binaryShift3 = 21 >>> 64;
+const int binaryShift4 = 84 >> 1;
+const int binaryShift5 = -1 >> 1;
+const bool binaryLess = 42 < 42;
+const bool binaryLessEqual = 42 <= 42;
+const bool binaryGreaterEqual = 42 >= 42;
+const bool binaryGreater = 42 > 42;
+const int doubleTruncateDiv = 84.2 ~/ 2;
+const int doubleTruncateDivZero = 84.2 ~/ 0;
+const int doubleTruncateDivNull = 84.2 ~/ null;
+const double doubleNan = 0/0;
+const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+const int bigNumber = 0x8000000000000000;
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart b/pkg/front_end/testcases/general/constants/js_semantics/various.dart
new file mode 100644
index 0000000..f2270ff
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const bool y = false;
+const bool z = !(y);
+
+const maybeInt = z ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const bool isItDouble = maybeInt is double ? true : false;
+
+const int actualInt = 42;
+const bool isItInt2 = actualInt is int ? true : false;
+const bool isItDouble2 = actualInt is double ? true : false;
+
+const maybeDouble = z ? 42.0 : true;
+const bool isItInt3 = maybeDouble is int ? true : false;
+const bool isItDouble3 = maybeDouble is double ? true : false;
+
+const double actualDouble = 42.0;
+const bool isItInt4 = actualDouble is int ? true : false;
+const bool isItDouble4 = actualDouble is double ? true : false;
+
+const maybeDouble2 = z ? 42.42 : true;
+const bool isItInt5 = maybeDouble2 is int ? true : false;
+const bool isItDouble5 = maybeDouble2 is double ? true : false;
+
+const double actualDouble2 = 42.42;
+const bool isItInt6 = actualDouble2 is int ? true : false;
+const bool isItDouble7 = actualDouble2 is double ? true : false;
+
+const zeroPointZeroIdentical = identical(0.0, 0.0);
+const zeroPointZeroIdenticalToZero = identical(0.0, 0);
+const zeroIdenticalToZeroPointZero = identical(0, 0.0);
+const nanIdentical = identical(0 / 0, 0 / 0);
+const stringIdentical = identical("hello", "hello");
+const string2Identical = identical("hello", "world");
+
+const zeroPointZeroEqual = 0.0 == 0.0;
+const zeroPointZeroEqualToZero = 0.0 == 0;
+const zeroEqualToZeroPointZero = 0 == 0.0;
+const nanEqual = 0 / 0 == 0 / 0;
+const stringEqual = "hello" == "hello";
+const string2Equal = "hello" == "world";
+
+const int intFortyTwo = 42;
+const String intStringConcat = "hello" "${intFortyTwo * intFortyTwo}";
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart.outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.outline.expect
new file mode 100644
index 0000000..f8811d2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.outline.expect
@@ -0,0 +1,38 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::bool* y = false;
+static const field core::bool* z = !self::y;
+static const field core::Object* maybeInt = self::z ?{core::Object*} 42 : true;
+static const field core::bool* isItInt = self::maybeInt is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble = self::maybeInt is core::double* ?{core::bool*} true : false;
+static const field core::int* actualInt = 42;
+static const field core::bool* isItInt2 = self::actualInt is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble2 = self::actualInt is core::double* ?{core::bool*} true : false;
+static const field core::Object* maybeDouble = self::z ?{core::Object*} 42.0 : true;
+static const field core::bool* isItInt3 = self::maybeDouble is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble3 = self::maybeDouble is core::double* ?{core::bool*} true : false;
+static const field core::double* actualDouble = 42.0;
+static const field core::bool* isItInt4 = self::actualDouble is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble4 = self::actualDouble is core::double* ?{core::bool*} true : false;
+static const field core::Object* maybeDouble2 = self::z ?{core::Object*} 42.42 : true;
+static const field core::bool* isItInt5 = self::maybeDouble2 is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble5 = self::maybeDouble2 is core::double* ?{core::bool*} true : false;
+static const field core::double* actualDouble2 = 42.42;
+static const field core::bool* isItInt6 = self::actualDouble2 is core::int* ?{core::bool*} true : false;
+static const field core::bool* isItDouble7 = self::actualDouble2 is core::double* ?{core::bool*} true : false;
+static const field core::bool* zeroPointZeroIdentical = core::identical(0.0, 0.0);
+static const field core::bool* zeroPointZeroIdenticalToZero = core::identical(0.0, 0);
+static const field core::bool* zeroIdenticalToZeroPointZero = core::identical(0, 0.0);
+static const field core::bool* nanIdentical = core::identical(0.{core::num::/}(0), 0.{core::num::/}(0));
+static const field core::bool* stringIdentical = core::identical("hello", "hello");
+static const field core::bool* string2Identical = core::identical("hello", "world");
+static const field core::bool* zeroPointZeroEqual = 0.0.{core::num::==}(0.0);
+static const field core::bool* zeroPointZeroEqualToZero = 0.0.{core::num::==}(0);
+static const field core::bool* zeroEqualToZeroPointZero = 0.{core::num::==}(0.0);
+static const field core::bool* nanEqual = 0.{core::num::/}(0).{core::num::==}(0.{core::num::/}(0));
+static const field core::bool* stringEqual = "hello".{core::String::==}("hello");
+static const field core::bool* string2Equal = "hello".{core::String::==}("world");
+static const field core::int* intFortyTwo = 42;
+static const field core::String* intStringConcat = "hello${self::intFortyTwo.{core::num::*}(self::intFortyTwo)}";
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.expect b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.expect
new file mode 100644
index 0000000..0570489
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.expect
@@ -0,0 +1,46 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::bool* y = #C1;
+static const field core::bool* z = #C2;
+static const field core::Object* maybeInt = #C3;
+static const field core::bool* isItInt = #C2;
+static const field core::bool* isItDouble = #C2;
+static const field core::int* actualInt = #C3;
+static const field core::bool* isItInt2 = #C2;
+static const field core::bool* isItDouble2 = #C2;
+static const field core::Object* maybeDouble = #C3;
+static const field core::bool* isItInt3 = #C2;
+static const field core::bool* isItDouble3 = #C2;
+static const field core::double* actualDouble = #C3;
+static const field core::bool* isItInt4 = #C2;
+static const field core::bool* isItDouble4 = #C2;
+static const field core::Object* maybeDouble2 = #C4;
+static const field core::bool* isItInt5 = #C1;
+static const field core::bool* isItDouble5 = #C2;
+static const field core::double* actualDouble2 = #C4;
+static const field core::bool* isItInt6 = #C1;
+static const field core::bool* isItDouble7 = #C2;
+static const field core::bool* zeroPointZeroIdentical = #C2;
+static const field core::bool* zeroPointZeroIdenticalToZero = #C2;
+static const field core::bool* zeroIdenticalToZeroPointZero = #C2;
+static const field core::bool* nanIdentical = #C1;
+static const field core::bool* stringIdentical = #C2;
+static const field core::bool* string2Identical = #C1;
+static const field core::bool* zeroPointZeroEqual = #C2;
+static const field core::bool* zeroPointZeroEqualToZero = #C2;
+static const field core::bool* zeroEqualToZeroPointZero = #C2;
+static const field core::bool* nanEqual = #C1;
+static const field core::bool* stringEqual = #C2;
+static const field core::bool* string2Equal = #C1;
+static const field core::int* intFortyTwo = #C3;
+static const field core::String* intStringConcat = #C5;
+
+constants {
+ #C1 = false
+ #C2 = true
+ #C3 = 42.0
+ #C4 = 42.42
+ #C5 = "hello1764"
+}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.transformed.expect
new file mode 100644
index 0000000..0570489
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.strong.transformed.expect
@@ -0,0 +1,46 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::bool* y = #C1;
+static const field core::bool* z = #C2;
+static const field core::Object* maybeInt = #C3;
+static const field core::bool* isItInt = #C2;
+static const field core::bool* isItDouble = #C2;
+static const field core::int* actualInt = #C3;
+static const field core::bool* isItInt2 = #C2;
+static const field core::bool* isItDouble2 = #C2;
+static const field core::Object* maybeDouble = #C3;
+static const field core::bool* isItInt3 = #C2;
+static const field core::bool* isItDouble3 = #C2;
+static const field core::double* actualDouble = #C3;
+static const field core::bool* isItInt4 = #C2;
+static const field core::bool* isItDouble4 = #C2;
+static const field core::Object* maybeDouble2 = #C4;
+static const field core::bool* isItInt5 = #C1;
+static const field core::bool* isItDouble5 = #C2;
+static const field core::double* actualDouble2 = #C4;
+static const field core::bool* isItInt6 = #C1;
+static const field core::bool* isItDouble7 = #C2;
+static const field core::bool* zeroPointZeroIdentical = #C2;
+static const field core::bool* zeroPointZeroIdenticalToZero = #C2;
+static const field core::bool* zeroIdenticalToZeroPointZero = #C2;
+static const field core::bool* nanIdentical = #C1;
+static const field core::bool* stringIdentical = #C2;
+static const field core::bool* string2Identical = #C1;
+static const field core::bool* zeroPointZeroEqual = #C2;
+static const field core::bool* zeroPointZeroEqualToZero = #C2;
+static const field core::bool* zeroEqualToZeroPointZero = #C2;
+static const field core::bool* nanEqual = #C1;
+static const field core::bool* stringEqual = #C2;
+static const field core::bool* string2Equal = #C1;
+static const field core::int* intFortyTwo = #C3;
+static const field core::String* intStringConcat = #C5;
+
+constants {
+ #C1 = false
+ #C2 = true
+ #C3 = 42.0
+ #C4 = 42.42
+ #C5 = "hello1764"
+}
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline.expect
new file mode 100644
index 0000000..4ca812c
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline.expect
@@ -0,0 +1,34 @@
+const bool y = false;
+const bool z = !(y);
+const maybeInt = z ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const bool isItDouble = maybeInt is double ? true : false;
+const int actualInt = 42;
+const bool isItInt2 = actualInt is int ? true : false;
+const bool isItDouble2 = actualInt is double ? true : false;
+const maybeDouble = z ? 42.0 : true;
+const bool isItInt3 = maybeDouble is int ? true : false;
+const bool isItDouble3 = maybeDouble is double ? true : false;
+const double actualDouble = 42.0;
+const bool isItInt4 = actualDouble is int ? true : false;
+const bool isItDouble4 = actualDouble is double ? true : false;
+const maybeDouble2 = z ? 42.42 : true;
+const bool isItInt5 = maybeDouble2 is int ? true : false;
+const bool isItDouble5 = maybeDouble2 is double ? true : false;
+const double actualDouble2 = 42.42;
+const bool isItInt6 = actualDouble2 is int ? true : false;
+const bool isItDouble7 = actualDouble2 is double ? true : false;
+const zeroPointZeroIdentical = identical(0.0, 0.0);
+const zeroPointZeroIdenticalToZero = identical(0.0, 0);
+const zeroIdenticalToZeroPointZero = identical(0, 0.0);
+const nanIdentical = identical(0 / 0, 0 / 0);
+const stringIdentical = identical("hello", "hello");
+const string2Identical = identical("hello", "world");
+const zeroPointZeroEqual = 0.0 == 0.0;
+const zeroPointZeroEqualToZero = 0.0 == 0;
+const zeroEqualToZeroPointZero = 0 == 0.0;
+const nanEqual = 0 / 0 == 0 / 0;
+const stringEqual = "hello" == "hello";
+const string2Equal = "hello" == "world";
+const int intFortyTwo = 42;
+const String intStringConcat = "hello" "${intFortyTwo * intFortyTwo}";
diff --git a/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..70b112b
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/js_semantics/various.dart.textual_outline_modelled.expect
@@ -0,0 +1,34 @@
+const String intStringConcat = "hello" "${intFortyTwo * intFortyTwo}";
+const bool isItDouble = maybeInt is double ? true : false;
+const bool isItDouble2 = actualInt is double ? true : false;
+const bool isItDouble3 = maybeDouble is double ? true : false;
+const bool isItDouble4 = actualDouble is double ? true : false;
+const bool isItDouble5 = maybeDouble2 is double ? true : false;
+const bool isItDouble7 = actualDouble2 is double ? true : false;
+const bool isItInt = maybeInt is int ? true : false;
+const bool isItInt2 = actualInt is int ? true : false;
+const bool isItInt3 = maybeDouble is int ? true : false;
+const bool isItInt4 = actualDouble is int ? true : false;
+const bool isItInt5 = maybeDouble2 is int ? true : false;
+const bool isItInt6 = actualDouble2 is int ? true : false;
+const bool y = false;
+const bool z = !(y);
+const double actualDouble = 42.0;
+const double actualDouble2 = 42.42;
+const int actualInt = 42;
+const int intFortyTwo = 42;
+const maybeDouble = z ? 42.0 : true;
+const maybeDouble2 = z ? 42.42 : true;
+const maybeInt = z ? 42 : true;
+const nanEqual = 0 / 0 == 0 / 0;
+const nanIdentical = identical(0 / 0, 0 / 0);
+const string2Equal = "hello" == "world";
+const string2Identical = identical("hello", "world");
+const stringEqual = "hello" == "hello";
+const stringIdentical = identical("hello", "hello");
+const zeroEqualToZeroPointZero = 0 == 0.0;
+const zeroIdenticalToZeroPointZero = identical(0, 0.0);
+const zeroPointZeroEqual = 0.0 == 0.0;
+const zeroPointZeroEqualToZero = 0.0 == 0;
+const zeroPointZeroIdentical = identical(0.0, 0.0);
+const zeroPointZeroIdenticalToZero = identical(0.0, 0);
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/folder.options b/pkg/front_end/testcases/general/constants/no_experiments/folder.options
new file mode 100644
index 0000000..db4ac03
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/folder.options
@@ -0,0 +1,3 @@
+-Dbaz=42
+-DbazTrue=true
+-DbazFalse=false
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart b/pkg/front_end/testcases/general/constants/no_experiments/various.dart
new file mode 100644
index 0000000..df79a2d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const Symbol tripleShiftSymbol = const Symbol(">>>");
+
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.outline.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.outline.expect
new file mode 100644
index 0000000..e41cc76
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.outline.expect
@@ -0,0 +1,8 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+static const field core::Symbol* tripleShiftSymbol = const _in::Symbol::•(">>>");
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.expect
new file mode 100644
index 0000000..d69a863
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.expect
@@ -0,0 +1,19 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:40: Error: Constant evaluation error:
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:47: Context: The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '">>>"'.
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:14: Context: While analyzing:
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+//
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::Symbol* tripleShiftSymbol = invalid-expression "The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '\">>>\"'.";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.transformed.expect
new file mode 100644
index 0000000..d69a863
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.strong.transformed.expect
@@ -0,0 +1,19 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:40: Error: Constant evaluation error:
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:47: Context: The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '">>>"'.
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+// pkg/front_end/testcases/general/constants/no_experiments/various.dart:5:14: Context: While analyzing:
+// const Symbol tripleShiftSymbol = const Symbol(">>>");
+// ^
+//
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::Symbol* tripleShiftSymbol = invalid-expression "The symbol name must be a valid public Dart member name, public constructor name, or library name, optionally qualified, but was '\">>>\"'.";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline.expect
new file mode 100644
index 0000000..3cb83df
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline.expect
@@ -0,0 +1,2 @@
+const Symbol tripleShiftSymbol = const Symbol(">>>");
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..3cb83df
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/no_experiments/various.dart.textual_outline_modelled.expect
@@ -0,0 +1,2 @@
+const Symbol tripleShiftSymbol = const Symbol(">>>");
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart b/pkg/front_end/testcases/general/constants/number_folds.dart
new file mode 100644
index 0000000..2069e49
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/number_folds.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int shiftNegative1 = 2 << -1;
+const int shiftNegative2 = 2 >>> -1;
+const int shiftNegative3 = 2 >> -1;
+const int modZero = 2 % 0;
+const int divZero = 2 / 0;
+const int intdivZero = 2 ~/ 0;
+const int unaryMinus = -2;
+const int unaryTilde = ~2;
+const int unaryPlus = +2;
+
+const int binaryPlus = 40 + 2;
+const int binaryMinus = 44 - 2;
+const int binaryTimes = 21 * 2;
+const double binaryDiv = 84 / 2;
+const int binaryTildeDiv = 84~/ 2;
+const int binaryMod = 85 % 43;
+const int binaryOr = 32 | 10;
+const int binaryAnd = 63 & 106;
+const int binaryXor = 63 ^ 21;
+const int binaryShift1 = 21 << 1;
+
+// These aren't currently defined on int :(.
+const int binaryShift2 = 84 >>> 1;
+const int binaryShift3 = 21 >>> 64;
+
+const int binaryShift4 = 84 >> 1;
+const bool binaryLess = 42 < 42;
+const bool binaryLessEqual = 42 <= 42;
+const bool binaryGreaterEqual = 42 >= 42;
+const bool binaryGreater = 42 > 42;
+
+const int doubleTruncateDiv = 84.2 ~/ 2;
+const int doubleTruncateDivZero = 84.2 ~/ 0;
+const int doubleTruncateDivNull = 84.2 ~/ null;
+const double doubleNan = 0/0;
+const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+
+main() {
+
+}
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.outline.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.outline.expect
new file mode 100644
index 0000000..bba3c85
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/number_folds.dart.outline.expect
@@ -0,0 +1,77 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = 2.{core::int::<<}(1.{core::int::unary-}());
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* shiftNegative3 = 2.{core::int::>>}(1.{core::int::unary-}());
+static const field core::int* modZero = 2.{core::num::%}(0);
+static const field core::int* divZero = let final<BottomType> #t1 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^" in 2.{core::num::/}(0) as{TypeError} core::int*;
+static const field core::int* intdivZero = 2.{core::num::~/}(0);
+static const field core::int* unaryMinus = 2.{core::int::unary-}();
+static const field core::int* unaryTilde = 2.{core::int::~}();
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^".+(2) as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryPlus = 40.{core::num::+}(2);
+static const field core::int* binaryMinus = 44.{core::num::-}(2);
+static const field core::int* binaryTimes = 21.{core::num::*}(2);
+static const field core::double* binaryDiv = 84.{core::num::/}(2);
+static const field core::int* binaryTildeDiv = 84.{core::num::~/}(2);
+static const field core::int* binaryMod = 85.{core::num::%}(43);
+static const field core::int* binaryOr = 32.{core::int::|}(10);
+static const field core::int* binaryAnd = 63.{core::int::&}(106);
+static const field core::int* binaryXor = 63.{core::int::^}(21);
+static const field core::int* binaryShift1 = 21.{core::int::<<}(1);
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^" as{TypeError,ForDynamic} core::int*;
+static const field core::int* binaryShift4 = 84.{core::int::>>}(1);
+static const field core::bool* binaryLess = 42.{core::num::<}(42);
+static const field core::bool* binaryLessEqual = 42.{core::num::<=}(42);
+static const field core::bool* binaryGreaterEqual = 42.{core::num::>=}(42);
+static const field core::bool* binaryGreater = 42.{core::num::>}(42);
+static const field core::int* doubleTruncateDiv = 84.2.{core::double::~/}(2);
+static const field core::int* doubleTruncateDivZero = 84.2.{core::double::~/}(0);
+static const field core::int* doubleTruncateDivNull = 84.2.{core::double::~/}(null);
+static const field core::double* doubleNan = 0.{core::num::/}(0);
+static const field core::int* doubleTruncateDivNaN = 84.2.{core::double::~/}(self::doubleNan);
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.strong.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.strong.expect
new file mode 100644
index 0000000..551adf0
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/number_folds.dart.strong.expect
@@ -0,0 +1,159 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:30: Error: Constant evaluation error:
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:30: Context: Binary operator '<<' on '2' requires non-negative operand, but was '-1'.
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:11: Context: While analyzing:
+// const int shiftNegative1 = 2 << -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:30: Error: Constant evaluation error:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:30: Context: Binary operator '>>' on '2' requires non-negative operand, but was '-1'.
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:11: Context: While analyzing:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:23: Error: Constant evaluation error:
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:23: Context: Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'.
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:11: Context: While analyzing:
+// const int modZero = 2 % 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:26: Error: Constant evaluation error:
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:26: Context: Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'.
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:11: Context: While analyzing:
+// const int intdivZero = 2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Error: Constant evaluation error:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:11: Context: While analyzing:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Error: Constant evaluation error:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:11: Context: While analyzing:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Error: Constant evaluation error:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN.
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:11: Context: While analyzing:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'.";
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^";
+static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'.";
+static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^";
+static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* unaryMinus = #C1;
+static const field core::int* unaryTilde = #C2;
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^";
+static const field core::int* binaryPlus = #C3;
+static const field core::int* binaryMinus = #C3;
+static const field core::int* binaryTimes = #C3;
+static const field core::double* binaryDiv = #C4;
+static const field core::int* binaryTildeDiv = #C3;
+static const field core::int* binaryMod = #C3;
+static const field core::int* binaryOr = #C3;
+static const field core::int* binaryAnd = #C3;
+static const field core::int* binaryXor = #C3;
+static const field core::int* binaryShift1 = #C3;
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^";
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^";
+static const field core::int* binaryShift4 = #C3;
+static const field core::bool* binaryLess = #C5;
+static const field core::bool* binaryLessEqual = #C6;
+static const field core::bool* binaryGreaterEqual = #C6;
+static const field core::bool* binaryGreater = #C5;
+static const field core::int* doubleTruncateDiv = #C3;
+static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.";
+static const field core::double* doubleNan = #C7;
+static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = -2
+ #C2 = -3
+ #C3 = 42
+ #C4 = 42.0
+ #C5 = false
+ #C6 = true
+ #C7 = NaN
+}
diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.strong.transformed.expect
new file mode 100644
index 0000000..551adf0
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/number_folds.dart.strong.transformed.expect
@@ -0,0 +1,159 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:30: Error: Constant evaluation error:
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:30: Context: Binary operator '<<' on '2' requires non-negative operand, but was '-1'.
+// const int shiftNegative1 = 2 << -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:5:11: Context: While analyzing:
+// const int shiftNegative1 = 2 << -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:30: Error: Constant evaluation error:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:30: Context: Binary operator '>>' on '2' requires non-negative operand, but was '-1'.
+// const int shiftNegative3 = 2 >> -1;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:7:11: Context: While analyzing:
+// const int shiftNegative3 = 2 >> -1;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:23: Error: Constant evaluation error:
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:23: Context: Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'.
+// const int modZero = 2 % 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:8:11: Context: While analyzing:
+// const int modZero = 2 % 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:26: Error: Constant evaluation error:
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:26: Context: Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'.
+// const int intdivZero = 2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:10:11: Context: While analyzing:
+// const int intdivZero = 2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Error: Constant evaluation error:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:40: Context: Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:37:11: Context: While analyzing:
+// const int doubleTruncateDivZero = 84.2 ~/ 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Error: Constant evaluation error:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:40: Context: Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:38:11: Context: While analyzing:
+// const int doubleTruncateDivNull = 84.2 ~/ null;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Error: Constant evaluation error:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:39: Context: Binary operator '84.2 ~/ NaN' results is Infinity or NaN.
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+// pkg/front_end/testcases/general/constants/number_folds.dart:40:11: Context: While analyzing:
+// const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: '+' is not a prefix operator.
+// Try removing '+'.
+// const int unaryPlus = +2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int shiftNegative2 = 2 >>> -1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+// const int divZero = 2 / 0;
+// ^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift2 = 84 >>> 1;
+// ^^^
+//
+// pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+// Try correcting the operator to an existing operator, or defining a '>>>' operator.
+// const int binaryShift3 = 21 >>> 64;
+// ^^^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* shiftNegative1 = invalid-expression "Binary operator '<<' on '2' requires non-negative operand, but was '-1'.";
+static const field core::int* shiftNegative2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:6:30: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int shiftNegative2 = 2 >>> -1;
+ ^^^";
+static const field core::int* shiftNegative3 = invalid-expression "Binary operator '>>' on '2' requires non-negative operand, but was '-1'.";
+static const field core::int* modZero = invalid-expression "Binary operator '%' on '2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* divZero = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:9:23: Error: A value of type 'double' can't be assigned to a variable of type 'int'.
+const int divZero = 2 / 0;
+ ^";
+static const field core::int* intdivZero = invalid-expression "Binary operator '~/' on '2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* unaryMinus = #C1;
+static const field core::int* unaryTilde = #C2;
+static const field core::int* unaryPlus = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:13:23: Error: This couldn't be parsed.
+const int unaryPlus = +2;
+ ^";
+static const field core::int* binaryPlus = #C3;
+static const field core::int* binaryMinus = #C3;
+static const field core::int* binaryTimes = #C3;
+static const field core::double* binaryDiv = #C4;
+static const field core::int* binaryTildeDiv = #C3;
+static const field core::int* binaryMod = #C3;
+static const field core::int* binaryOr = #C3;
+static const field core::int* binaryAnd = #C3;
+static const field core::int* binaryXor = #C3;
+static const field core::int* binaryShift1 = #C3;
+static const field core::int* binaryShift2 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:27:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift2 = 84 >>> 1;
+ ^^^";
+static const field core::int* binaryShift3 = invalid-expression "pkg/front_end/testcases/general/constants/number_folds.dart:28:29: Error: The operator '>>>' isn't defined for the class 'int'.
+Try correcting the operator to an existing operator, or defining a '>>>' operator.
+const int binaryShift3 = 21 >>> 64;
+ ^^^";
+static const field core::int* binaryShift4 = #C3;
+static const field core::bool* binaryLess = #C5;
+static const field core::bool* binaryLessEqual = #C6;
+static const field core::bool* binaryGreaterEqual = #C6;
+static const field core::bool* binaryGreater = #C5;
+static const field core::int* doubleTruncateDiv = #C3;
+static const field core::int* doubleTruncateDivZero = invalid-expression "Binary operator '~/' on '84.2' requires non-zero divisor, but divisor was '0'.";
+static const field core::int* doubleTruncateDivNull = invalid-expression "Binary operator '~/' on '84.2' requires operand of type 'num', but was of type 'Null'.";
+static const field core::double* doubleNan = #C7;
+static const field core::int* doubleTruncateDivNaN = invalid-expression "Binary operator '84.2 ~/ NaN' results is Infinity or NaN.";
+static method main() → dynamic {}
+
+constants {
+ #C1 = -2
+ #C2 = -3
+ #C3 = 42
+ #C4 = 42.0
+ #C5 = false
+ #C6 = true
+ #C7 = NaN
+}
diff --git a/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect
new file mode 100644
index 0000000..20ada74
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/number_folds.dart.textual_outline.expect
@@ -0,0 +1,32 @@
+const int shiftNegative1 = 2 << -1;
+const int shiftNegative2 = 2 >>> -1;
+const int shiftNegative3 = 2 >> -1;
+const int modZero = 2 % 0;
+const int divZero = 2 / 0;
+const int intdivZero = 2 ~/ 0;
+const int unaryMinus = -2;
+const int unaryTilde = ~2;
+const int unaryPlus = +2;
+const int binaryPlus = 40 + 2;
+const int binaryMinus = 44 - 2;
+const int binaryTimes = 21 * 2;
+const double binaryDiv = 84 / 2;
+const int binaryTildeDiv = 84~/ 2;
+const int binaryMod = 85 % 43;
+const int binaryOr = 32 | 10;
+const int binaryAnd = 63 & 106;
+const int binaryXor = 63 ^ 21;
+const int binaryShift1 = 21 << 1;
+const int binaryShift2 = 84 >>> 1;
+const int binaryShift3 = 21 >>> 64;
+const int binaryShift4 = 84 >> 1;
+const bool binaryLess = 42 < 42;
+const bool binaryLessEqual = 42 <= 42;
+const bool binaryGreaterEqual = 42 >= 42;
+const bool binaryGreater = 42 > 42;
+const int doubleTruncateDiv = 84.2 ~/ 2;
+const int doubleTruncateDivZero = 84.2 ~/ 0;
+const int doubleTruncateDivNull = 84.2 ~/ null;
+const double doubleNan = 0/0;
+const int doubleTruncateDivNaN = 84.2 ~/ doubleNan;
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart
new file mode 100644
index 0000000..9eb86b4
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int foo = 42 * 42;
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const String bar2 = "hello2" " 2" + bar;
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const blaSymbol = #_x;
+
+main() {
+ _x();
+ const bool.fromEnvironment("foo");
+ print(bar);
+}
+
+void _x() {
+ print(foo);
+ print(bar);
+}
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.outline.expect b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.outline.expect
new file mode 100644
index 0000000..4a108d2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.outline.expect
@@ -0,0 +1,13 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* foo = 42.{core::num::*}(42);
+static const field core::String* bar = "hello ${const core::String::fromEnvironment("baz", defaultValue: "world")}!";
+static const field core::String* bar2 = "hello2 2".{core::String::+}(self::bar);
+static const field core::bool* baz = true && true && (false || true) && 42.{core::num::==}(21.{core::num::*}(4).{core::num::/}(2));
+static const field core::Symbol* blaSymbol = #_x;
+static method main() → dynamic
+ ;
+static method _x() → void
+ ;
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.expect b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.expect
new file mode 100644
index 0000000..f3b74df
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* foo = #C1;
+static const field core::String* bar = #C2;
+static const field core::String* bar2 = #C3;
+static const field core::bool* baz = #C4;
+static const field core::Symbol* blaSymbol = #C5;
+static method main() → dynamic {
+ self::_x();
+ #C6;
+ core::print(#C2);
+}
+static method _x() → void {
+ core::print(#C1);
+ core::print(#C2);
+}
+
+constants {
+ #C1 = 1764
+ #C2 = "hello 42!"
+ #C3 = "hello2 2hello 42!"
+ #C4 = true
+ #C5 = #org-dartlang-testcase:///rudimentary_test_01.dart::_x
+ #C6 = false
+}
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.transformed.expect
new file mode 100644
index 0000000..f3b74df
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.strong.transformed.expect
@@ -0,0 +1,27 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int* foo = #C1;
+static const field core::String* bar = #C2;
+static const field core::String* bar2 = #C3;
+static const field core::bool* baz = #C4;
+static const field core::Symbol* blaSymbol = #C5;
+static method main() → dynamic {
+ self::_x();
+ #C6;
+ core::print(#C2);
+}
+static method _x() → void {
+ core::print(#C1);
+ core::print(#C2);
+}
+
+constants {
+ #C1 = 1764
+ #C2 = "hello 42!"
+ #C3 = "hello2 2hello 42!"
+ #C4 = true
+ #C5 = #org-dartlang-testcase:///rudimentary_test_01.dart::_x
+ #C6 = false
+}
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline.expect
new file mode 100644
index 0000000..c369a44
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline.expect
@@ -0,0 +1,8 @@
+const int foo = 42 * 42;
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const String bar2 = "hello2" " 2" + bar;
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const blaSymbol = #_x;
+main() {}
+void _x() {}
diff --git a/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..fc42499
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/rudimentary_test_01.dart.textual_outline_modelled.expect
@@ -0,0 +1,8 @@
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const String bar2 = "hello2" " 2" + bar;
+const blaSymbol = #_x;
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const int foo = 42 * 42;
+main() {}
+void _x() {}
diff --git a/pkg/front_end/testcases/general/constants/various.dart b/pkg/front_end/testcases/general/constants/various.dart
new file mode 100644
index 0000000..a4ebf42
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart
@@ -0,0 +1,220 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// Environment does not contain "bar".
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const bool barFromEnvOrNull =
+ const bool.fromEnvironment("bar", defaultValue: null);
+const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+const bool nullAwareOnNullTrue = barFromEnvOrNull ?? true;
+const bool nullAwareOnNullFalse = barFromEnvOrNull ?? false;
+const bool andOnFalse = nullAwareOnNullFalse && nullAwareOnNullTrue;
+const bool andOnFalse2 = nullAwareOnNullTrue && nullAwareOnNullFalse;
+const bool andOnNull = barFromEnvOrNull && true;
+const bool andOnNull2 = true && barFromEnvOrNull;
+const bool orOnNull = barFromEnvOrNull || true;
+const bool orOnNull2 = barFromEnvOrNull || false;
+const bool orOnNull3 = true || barFromEnvOrNull;
+const bool orOnNull4 = false || barFromEnvOrNull;
+
+const String barFromEnvString = const String.fromEnvironment("bar");
+const String barFromEnvOrNullString =
+ const String.fromEnvironment("bar", defaultValue: null);
+const String barFromEnvOrActualString =
+ const String.fromEnvironment("bar", defaultValue: "hello");
+const String nullFromEnvString =
+ const String.fromEnvironment(barFromEnvOrNullString);
+
+const bool barFromEnvBool = const bool.fromEnvironment("bar");
+const bool barFromEnvOrNullBool =
+ const bool.fromEnvironment("bar", defaultValue: null);
+const bool barFromEnvOrActualBool =
+ const bool.fromEnvironment("bar", defaultValue: true);
+const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+
+const int barFromEnvInt = const int.fromEnvironment("bar");
+const int barFromEnvOrNullInt =
+ const int.fromEnvironment("bar", defaultValue: null);
+const int barFromEnvOrActualInt =
+ const int.fromEnvironment("bar", defaultValue: 42);
+const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+
+// Environment does contain "baz" (value '42', i.e. neither true nor false).
+const bool bazFromEnv = const bool.fromEnvironment("baz");
+const bool hasBazEnv = const bool.hasEnvironment("baz");
+const int bazFromEnvAsInt = const int.fromEnvironment("baz");
+const String bazFromEnvAsString = const String.fromEnvironment("baz");
+
+// Environment does contain "bazTrue" (value 'true') and
+// "bazFalse" (value 'false').
+const bool bazTrueFromEnv = const bool.fromEnvironment("bazTrue");
+const bool bazFalseFromEnv = const bool.fromEnvironment("bazFalse");
+
+const bool trueBool = true;
+const bool falseBool = false;
+const bool binaryOnBoolCaret = trueBool ^ falseBool;
+const bool binaryOnBoolAmpersand = trueBool & falseBool;
+const bool binaryOnBoolBar = trueBool | falseBool;
+const bool binaryOnBoolBar2 = falseBool | trueBool;
+
+const dynamic willBeDouble = const bool.fromEnvironment("foo") ? 42 : 42.42;
+const binaryOnDouble = willBeDouble << 2;
+const dynamic willBeInt = const bool.fromEnvironment("foo") ? 42.42 : 42;
+const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+const binaryOnIntWithDoubleOK = willBeInt + willBeDouble;
+const binaryOnIntWithString = willBeInt << "hello";
+const dynamic willBeString =
+ const bool.fromEnvironment("foo") ? 42.42 : "hello";
+const binaryOnStringWithStringOK = willBeString + " world";
+const binaryOnStringWithInt = willBeString + willBeInt;
+const binaryOnStringWithStringBad = willBeString - " world";
+
+var x = 1;
+const x1 = --x;
+const x2 = ++x;
+const x3 = x--;
+const x4 = x++;
+
+const y = 1;
+const y1 = --y;
+const y2 = ++y;
+const y3 = y--;
+const y4 = y++;
+
+abstract class AbstractClass {}
+
+abstract class AbstractClassWithConstructor {
+ const AbstractClassWithConstructor();
+
+ int foo();
+}
+
+AbstractClassWithConstructor abstractClassWithConstructor =
+ const AbstractClassWithConstructor();
+
+class NotAbstractClass {
+ @AbstractClass()
+ Object foo;
+
+ @AbstractClassWithConstructor()
+ Object bar;
+}
+
+class Foo {
+ final int x;
+ final int y;
+ const Foo(int x)
+ : this.x = x,
+ this.y = "hello".length;
+}
+
+class ExtendsFoo1 extends Foo {
+ // No constructor.
+}
+
+const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+
+class ExtendsFoo2 extends Foo {
+ const ExtendsFoo2();
+}
+
+const ExtendsFoo2 extendsFoo2 = const ExtendsFoo2();
+
+const Foo foo1 = const Foo(42);
+const Foo foo2 = const Foo(42);
+const bool foosIdentical = identical(foo1, foo2);
+const bool foosEqual = foo1 == foo2;
+const Symbol barFoo = const Symbol("Foo");
+const Symbol barFooEqual = const Symbol("Foo=");
+const Symbol tripleShiftSymbol = const Symbol(">>>");
+const Symbol symbolWithDots = const Symbol("I.Have.Dots");
+
+const int circularity1 = circularity2;
+const int circularity2 = circularity3;
+const int circularity3 = circularity4;
+const int circularity4 = circularity1;
+
+const function_const = () {};
+var function_var = () {};
+
+class ConstClassWithFailingAssertWithEmptyMessage {
+ const ConstClassWithFailingAssertWithEmptyMessage() : assert(false, "");
+}
+
+ConstClassWithFailingAssertWithEmptyMessage failedAssertEmptyMessage =
+ const ConstClassWithFailingAssertWithEmptyMessage();
+
+class ClassWithTypeArguments<E, F, G> {
+ const ClassWithTypeArguments(E e, F f, G g);
+}
+
+const ClassWithTypeArguments classWithTypeArguments1 =
+ const ClassWithTypeArguments<int, int, int>(42, 42, 42);
+const ClassWithTypeArguments classWithTypeArguments2 =
+ const ClassWithTypeArguments(42, 42, 42);
+const bool classWithTypeArgumentsIdentical =
+ identical(classWithTypeArguments1, classWithTypeArguments2);
+
+class ClassWithNonEmptyConstConstructor {
+ const ClassWithNonEmptyConstConstructor() {
+ print("hello");
+ }
+}
+
+ClassWithNonEmptyConstConstructor classWithNonEmptyConstConstructor =
+ const ClassWithNonEmptyConstConstructor();
+
+class ConstClassWithFinalFields1 {
+ const ConstClassWithFinalFields1();
+
+ final x = 1;
+}
+
+class ConstClassWithFinalFields2 {
+ const ConstClassWithFinalFields2();
+
+ final y = 1;
+ final z1 = y;
+ final z2 = x;
+}
+
+ConstClassWithFinalFields2 constClassWithFinalFields =
+ const ConstClassWithFinalFields2();
+
+const zeroPointZeroIdentical = identical(0.0, 0.0);
+const zeroPointZeroIdenticalToZero = identical(0.0, 0);
+const zeroIdenticalToZeroPointZero = identical(0, 0.0);
+const nanIdentical = identical(0 / 0, 0 / 0);
+
+const zeroPointZeroEqual = 0.0 == 0.0;
+const zeroPointZeroEqualToZero = 0.0 == 0;
+const zeroEqualToZeroPointZero = 0 == 0.0;
+const nanEqual = 0 / 0 == 0 / 0;
+
+T id1<T>(T t) => t;
+T id2<T>(T t) => t;
+
+const dynamic willBecomeNull = const bool.fromEnvironment("foo") ? id1 : null;
+
+const int Function(int) willBecomeNullToo =
+ const bool.fromEnvironment("foo") ? id1 : willBecomeNull;
+const int Function(int) partialInstantiation =
+ const bool.fromEnvironment("foo") ? willBecomeNull : id1;
+
+const bool yBool = true;
+const bool zBool = !yBool;
+
+const maybeInt = bool.fromEnvironment("foo") ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const maybeInt2 = zBool ? 42 : true;
+const bool isItInt2 = maybeInt2 is int ? true : false;
+const maybeInt3 = zBool ? 42 : null;
+const bool isItInt3 = maybeInt3 is int ? true : false;
+
+main() {
+ print(barFromEnv);
+ print(hasBarEnv);
+}
diff --git a/pkg/front_end/testcases/general/constants/various.dart.outline.expect b/pkg/front_end/testcases/general/constants/various.dart.outline.expect
new file mode 100644
index 0000000..8a18319
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart.outline.expect
@@ -0,0 +1,368 @@
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/various.dart:162:3: Error: A const constructor can't have a body.
+// Try removing either the 'const' keyword or the body.
+// const ClassWithNonEmptyConstConstructor() {
+// ^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:76:14: Error: Not a constant expression.
+// const x1 = --x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:77:14: Error: Not a constant expression.
+// const x2 = ++x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:78:12: Error: Not a constant expression.
+// const x3 = x--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:79:12: Error: Not a constant expression.
+// const x4 = x++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+// const y1 = --y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+// const y2 = ++y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+// const y3 = y--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+// const y4 = y++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+// const function_const = () {};
+// ^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Can't access 'this' in a field initializer to read 'y'.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: The class 'AbstractClass' is abstract and can't be instantiated.
+// @AbstractClass()
+// ^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClass()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: The class 'AbstractClassWithConstructor' is abstract and can't be instantiated.
+// @AbstractClassWithConstructor()
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClassWithConstructor()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+// const ExtendsFoo2();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Not a constant expression.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:181:14: Error: Not a constant expression.
+// final z2 = x;
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+abstract class AbstractClass extends core::Object {
+ synthetic constructor •() → self::AbstractClass*
+ ;
+ 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
+}
+abstract class AbstractClassWithConstructor extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::AbstractClassWithConstructor*
+ : super core::Object::•()
+ ;
+ abstract method foo() → core::int*;
+ 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 NotAbstractClass extends core::Object {
+ @throw invalid-expression "pkg/front_end/testcases/general/constants/various.dart:99:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ @AbstractClass()
+ ^"
+ field core::Object* foo;
+ @throw invalid-expression "pkg/front_end/testcases/general/constants/various.dart:102:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ @AbstractClassWithConstructor()
+ ^"
+ field core::Object* bar;
+ synthetic constructor •() → self::NotAbstractClass*
+ ;
+ 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 Foo extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x;
+ final field core::int* y;
+ const constructor •(core::int* x) → self::Foo*
+ : self::Foo::x = x, self::Foo::y = "hello".{core::String::length}, 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 ExtendsFoo1 extends self::Foo {
+ synthetic constructor •() → self::ExtendsFoo1*
+ ;
+}
+class ExtendsFoo2 extends self::Foo /*hasConstConstructor*/ {
+ const constructor •() → self::ExtendsFoo2*
+ : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+ const ExtendsFoo2();
+ ^^^^^^^^^^^"
+ ;
+}
+class ConstClassWithFailingAssertWithEmptyMessage extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::ConstClassWithFailingAssertWithEmptyMessage*
+ : assert(false, ""), 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 ClassWithTypeArguments<E extends core::Object* = dynamic, F extends core::Object* = dynamic, G extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ const constructor •(self::ClassWithTypeArguments::E* e, self::ClassWithTypeArguments::F* f, self::ClassWithTypeArguments::G* g) → self::ClassWithTypeArguments<self::ClassWithTypeArguments::E*, self::ClassWithTypeArguments::F*, self::ClassWithTypeArguments::G*>*
+ : 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 ClassWithNonEmptyConstConstructor extends core::Object {
+ constructor •() → self::ClassWithNonEmptyConstConstructor*
+ ;
+ 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 ConstClassWithFinalFields1 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x = 1;
+ const constructor •() → self::ConstClassWithFinalFields1*
+ : 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 ConstClassWithFinalFields2 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* y = 1;
+ final field dynamic z1 = this.{self::ConstClassWithFinalFields2::y};
+ final field core::int* z2 = self::x;
+ const constructor •() → self::ConstClassWithFinalFields2*
+ : 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 core::bool* barFromEnv = const core::bool::fromEnvironment("bar");
+static const field core::bool* hasBarEnv = const core::bool::hasEnvironment("bar");
+static const field core::bool* barFromEnvOrNull = const core::bool::fromEnvironment("bar", defaultValue: null);
+static const field core::bool* notBarFromEnvOrNull = !self::barFromEnvOrNull;
+static const field core::bool* conditionalOnNull = self::barFromEnvOrNull ?{core::bool*} true : false;
+static const field core::bool* nullAwareOnNullTrue = let final core::bool* #t2 = self::barFromEnvOrNull in #t2.{core::Object::==}(null) ?{core::bool*} true : #t2;
+static const field core::bool* nullAwareOnNullFalse = let final core::bool* #t3 = self::barFromEnvOrNull in #t3.{core::Object::==}(null) ?{core::bool*} false : #t3;
+static const field core::bool* andOnFalse = self::nullAwareOnNullFalse && self::nullAwareOnNullTrue;
+static const field core::bool* andOnFalse2 = self::nullAwareOnNullTrue && self::nullAwareOnNullFalse;
+static const field core::bool* andOnNull = self::barFromEnvOrNull && true;
+static const field core::bool* andOnNull2 = true && self::barFromEnvOrNull;
+static const field core::bool* orOnNull = self::barFromEnvOrNull || true;
+static const field core::bool* orOnNull2 = self::barFromEnvOrNull || false;
+static const field core::bool* orOnNull3 = true || self::barFromEnvOrNull;
+static const field core::bool* orOnNull4 = false || self::barFromEnvOrNull;
+static const field core::String* barFromEnvString = const core::String::fromEnvironment("bar");
+static const field core::String* barFromEnvOrNullString = const core::String::fromEnvironment("bar", defaultValue: null);
+static const field core::String* barFromEnvOrActualString = const core::String::fromEnvironment("bar", defaultValue: "hello");
+static const field core::String* nullFromEnvString = const core::String::fromEnvironment(self::barFromEnvOrNullString);
+static const field core::bool* barFromEnvBool = const core::bool::fromEnvironment("bar");
+static const field core::bool* barFromEnvOrNullBool = const core::bool::fromEnvironment("bar", defaultValue: null);
+static const field core::bool* barFromEnvOrActualBool = const core::bool::fromEnvironment("bar", defaultValue: true);
+static const field core::bool* nullFromEnvBool = const core::bool::fromEnvironment(self::barFromEnvOrNullString);
+static const field core::int* barFromEnvInt = const core::int::fromEnvironment("bar");
+static const field core::int* barFromEnvOrNullInt = const core::int::fromEnvironment("bar", defaultValue: null);
+static const field core::int* barFromEnvOrActualInt = const core::int::fromEnvironment("bar", defaultValue: 42);
+static const field core::int* nullFromEnvInt = const core::int::fromEnvironment(self::barFromEnvOrNullString);
+static const field core::bool* bazFromEnv = const core::bool::fromEnvironment("baz");
+static const field core::bool* hasBazEnv = const core::bool::hasEnvironment("baz");
+static const field core::int* bazFromEnvAsInt = const core::int::fromEnvironment("baz");
+static const field core::String* bazFromEnvAsString = const core::String::fromEnvironment("baz");
+static const field core::bool* bazTrueFromEnv = const core::bool::fromEnvironment("bazTrue");
+static const field core::bool* bazFalseFromEnv = const core::bool::fromEnvironment("bazFalse");
+static const field core::bool* trueBool = true;
+static const field core::bool* falseBool = false;
+static const field core::bool* binaryOnBoolCaret = self::trueBool.{core::bool::^}(self::falseBool);
+static const field core::bool* binaryOnBoolAmpersand = self::trueBool.{core::bool::&}(self::falseBool);
+static const field core::bool* binaryOnBoolBar = self::trueBool.{core::bool::|}(self::falseBool);
+static const field core::bool* binaryOnBoolBar2 = self::falseBool.{core::bool::|}(self::trueBool);
+static const field dynamic willBeDouble = const core::bool::fromEnvironment("foo") ?{core::num*} 42 : 42.42;
+static const field dynamic binaryOnDouble = self::willBeDouble.<<(2);
+static const field dynamic willBeInt = const core::bool::fromEnvironment("foo") ?{core::num*} 42.42 : 42;
+static const field dynamic binaryOnIntWithDoubleBad = self::willBeInt.<<(self::willBeDouble);
+static const field dynamic binaryOnIntWithDoubleOK = self::willBeInt.+(self::willBeDouble);
+static const field dynamic binaryOnIntWithString = self::willBeInt.<<("hello");
+static const field dynamic willBeString = const core::bool::fromEnvironment("foo") ?{core::Object*} 42.42 : "hello";
+static const field dynamic binaryOnStringWithStringOK = self::willBeString.+(" world");
+static const field dynamic binaryOnStringWithInt = self::willBeString.+(self::willBeInt);
+static const field dynamic binaryOnStringWithStringBad = self::willBeString.-(" world");
+static field core::int* x;
+static const field core::int* x1 = self::x = self::x.{core::num::-}(1);
+static const field core::int* x2 = self::x = self::x.{core::num::+}(1);
+static const field core::int* x3 = let final core::int* #t4 = self::x in let final core::int* #t5 = self::x = #t4.{core::num::-}(1) in #t4;
+static const field core::int* x4 = let final core::int* #t6 = self::x in let final core::int* #t7 = self::x = #t6.{core::num::+}(1) in #t6;
+static const field core::int* y = 1;
+static const field dynamic y1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+const y1 = --y;
+ ^";
+static const field dynamic y2 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+const y2 = ++y;
+ ^";
+static const field core::int* y3 = let final core::int* #t8 = self::y in let final dynamic #t9 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+const y3 = y--;
+ ^" in #t8;
+static const field core::int* y4 = let final core::int* #t10 = self::y in let final dynamic #t11 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+const y4 = y++;
+ ^" in #t10;
+static field self::AbstractClassWithConstructor* abstractClassWithConstructor;
+static const field self::ExtendsFoo1* extendsFoo1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+ ^^^^^^^^^^^" as{TypeError,ForDynamic} self::ExtendsFoo1*;
+static const field self::ExtendsFoo2* extendsFoo2 = const self::ExtendsFoo2::•();
+static const field self::Foo* foo1 = const self::Foo::•(42);
+static const field self::Foo* foo2 = const self::Foo::•(42);
+static const field core::bool* foosIdentical = core::identical(self::foo1, self::foo2);
+static const field core::bool* foosEqual = self::foo1.{self::Foo::==}(self::foo2);
+static const field core::Symbol* barFoo = const _in::Symbol::•("Foo");
+static const field core::Symbol* barFooEqual = const _in::Symbol::•("Foo=");
+static const field core::Symbol* tripleShiftSymbol = const _in::Symbol::•(">>>");
+static const field core::Symbol* symbolWithDots = const _in::Symbol::•("I.Have.Dots");
+static const field core::int* circularity1 = self::circularity2;
+static const field core::int* circularity2 = self::circularity3;
+static const field core::int* circularity3 = self::circularity4;
+static const field core::int* circularity4 = self::circularity1;
+static const field dynamic function_const = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+const function_const = () {};
+ ^^";
+static field () →* core::Null? function_var;
+static field self::ConstClassWithFailingAssertWithEmptyMessage* failedAssertEmptyMessage;
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments1 = const self::ClassWithTypeArguments::•<core::int*, core::int*, core::int*>(42, 42, 42);
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments2 = const self::ClassWithTypeArguments::•<dynamic, dynamic, dynamic>(42, 42, 42);
+static const field core::bool* classWithTypeArgumentsIdentical = core::identical(self::classWithTypeArguments1, self::classWithTypeArguments2);
+static field self::ClassWithNonEmptyConstConstructor* classWithNonEmptyConstConstructor;
+static field self::ConstClassWithFinalFields2* constClassWithFinalFields;
+static const field core::bool* zeroPointZeroIdentical = core::identical(0.0, 0.0);
+static const field core::bool* zeroPointZeroIdenticalToZero = core::identical(0.0, 0);
+static const field core::bool* zeroIdenticalToZeroPointZero = core::identical(0, 0.0);
+static const field core::bool* nanIdentical = core::identical(0.{core::num::/}(0), 0.{core::num::/}(0));
+static const field core::bool* zeroPointZeroEqual = 0.0.{core::num::==}(0.0);
+static const field core::bool* zeroPointZeroEqualToZero = 0.0.{core::num::==}(0);
+static const field core::bool* zeroEqualToZeroPointZero = 0.{core::num::==}(0.0);
+static const field core::bool* nanEqual = 0.{core::num::/}(0).{core::num::==}(0.{core::num::/}(0));
+static const field dynamic willBecomeNull = const core::bool::fromEnvironment("foo") ?{<T extends core::Object* = dynamic>(T*) →* T*} self::id1 : null;
+static const field (core::int*) →* core::int* willBecomeNullToo = (const core::bool::fromEnvironment("foo") ?{dynamic} self::id1<core::int*> : self::willBecomeNull) as{TypeError,ForDynamic} (core::int*) →* core::int*;
+static const field (core::int*) →* core::int* partialInstantiation = (const core::bool::fromEnvironment("foo") ?{dynamic} self::willBecomeNull : self::id1<core::int*>) as{TypeError,ForDynamic} (core::int*) →* core::int*;
+static const field core::bool* yBool = true;
+static const field core::bool* zBool = !self::yBool;
+static const field core::Object* maybeInt = const core::bool::fromEnvironment("foo") ?{core::Object*} 42 : true;
+static const field core::bool* isItInt = self::maybeInt is core::int* ?{core::bool*} true : false;
+static const field core::Object* maybeInt2 = self::zBool ?{core::Object*} 42 : true;
+static const field core::bool* isItInt2 = self::maybeInt2 is core::int* ?{core::bool*} true : false;
+static const field core::int* maybeInt3 = self::zBool ?{core::int*} 42 : null;
+static const field core::bool* isItInt3 = self::maybeInt3 is core::int* ?{core::bool*} true : false;
+static method id1<T extends core::Object* = dynamic>(self::id1::T* t) → self::id1::T*
+ ;
+static method id2<T extends core::Object* = dynamic>(self::id2::T* t) → self::id2::T*
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/various.dart.strong.expect b/pkg/front_end/testcases/general/constants/various.dart.strong.expect
new file mode 100644
index 0000000..eb69153
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart.strong.expect
@@ -0,0 +1,629 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/various.dart:10:34: Error: Constant evaluation error:
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:10:34: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'.
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:10:12: Context: While analyzing:
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:11:49: Error: Constant evaluation error:
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:11:32: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'.
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:11:12: Context: While analyzing:
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:16:41: Error: Constant evaluation error:
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:16:41: Context: The method '&&' can't be invoked on 'null' in a constant expression.
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:16:12: Context: While analyzing:
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:17:30: Error: Constant evaluation error:
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:17:30: Context: Binary operator '&&' on 'true' requires operand of type 'bool', but was of type 'Null'.
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:17:12: Context: While analyzing:
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:18:40: Error: Constant evaluation error:
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:18:40: Context: The method '||' can't be invoked on 'null' in a constant expression.
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:18:12: Context: While analyzing:
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:19:41: Error: Constant evaluation error:
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:19:41: Context: The method '||' can't be invoked on 'null' in a constant expression.
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:19:12: Context: While analyzing:
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:21:30: Error: Constant evaluation error:
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:21:30: Context: Binary operator '||' on 'false' requires operand of type 'bool', but was of type 'Null'.
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:21:12: Context: While analyzing:
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:29:11: Error: Constant evaluation error:
+// const String.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:29:11: Context: Null value during constant evaluation.
+// const String.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:28:14: Context: While analyzing:
+// const String nullFromEnvString =
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:36:36: Error: Constant evaluation error:
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:36:36: Context: Null value during constant evaluation.
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:36:12: Context: While analyzing:
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:43:34: Error: Constant evaluation error:
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:43:34: Context: Null value during constant evaluation.
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:43:11: Context: While analyzing:
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:64:37: Error: Constant evaluation error:
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:64:37: Context: Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:64:7: Context: While analyzing:
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:66:44: Error: Constant evaluation error:
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:66:44: Context: Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:66:7: Context: While analyzing:
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:68:41: Error: Constant evaluation error:
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:68:41: Context: Binary operator '<<' on '42' requires operand of type 'num', but was of type 'String'.
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:68:7: Context: While analyzing:
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:72:44: Error: Constant evaluation error:
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:72:44: Context: Binary operator '+' on '"hello"' requires operand of type 'String', but was of type 'int'.
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:72:7: Context: While analyzing:
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:73:50: Error: Constant evaluation error:
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:73:50: Context: The method '-' can't be invoked on '"hello"' in a constant expression.
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:73:7: Context: While analyzing:
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:78:13: Error: Constant evaluation error:
+// const x3 = x--;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:78:12: Context: The invocation of 'x' is not allowed in a constant expression.
+// const x3 = x--;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:78:7: Context: While analyzing:
+// const x3 = x--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:79:13: Error: Constant evaluation error:
+// const x4 = x++;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:79:12: Context: The invocation of 'x' is not allowed in a constant expression.
+// const x4 = x++;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:79:7: Context: While analyzing:
+// const x4 = x++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:129:29: Error: Constant evaluation error:
+// const bool foosEqual = foo1 == foo2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:129:29: Context: Binary operator '==' requires receiver constant 'Foo {x: 42, y: 5}' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/general/constants/various.dart'.
+// const bool foosEqual = foo1 == foo2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:129:12: Context: While analyzing:
+// const bool foosEqual = foo1 == foo2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:135:26: Error: Constant evaluation error:
+// const int circularity1 = circularity2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:135:26: Context: Constant expression depends on itself.
+// const int circularity1 = circularity2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:135:11: Context: While analyzing:
+// const int circularity1 = circularity2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:148:11: Error: Constant evaluation error:
+// const ConstClassWithFailingAssertWithEmptyMessage();
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:144:64: Context: This assertion failed with message: (empty)
+// const ConstClassWithFailingAssertWithEmptyMessage() : assert(false, "");
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:185:11: Error: Constant evaluation error:
+// const ConstClassWithFinalFields2();
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:181:14: Context: The invocation of 'x' is not allowed in a constant expression.
+// final z2 = x;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/various.dart:162:3: Error: A const constructor can't have a body.
+// Try removing either the 'const' keyword or the body.
+// const ClassWithNonEmptyConstConstructor() {
+// ^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:76:14: Error: Not a constant expression.
+// const x1 = --x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:77:14: Error: Not a constant expression.
+// const x2 = ++x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:78:12: Error: Not a constant expression.
+// const x3 = x--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:79:12: Error: Not a constant expression.
+// const x4 = x++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+// const y1 = --y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+// const y2 = ++y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+// const y3 = y--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+// const y4 = y++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+// const function_const = () {};
+// ^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Can't access 'this' in a field initializer to read 'y'.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: The class 'AbstractClass' is abstract and can't be instantiated.
+// @AbstractClass()
+// ^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClass()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: The class 'AbstractClassWithConstructor' is abstract and can't be instantiated.
+// @AbstractClassWithConstructor()
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClassWithConstructor()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+// const ExtendsFoo2();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Not a constant expression.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:181:14: Error: Not a constant expression.
+// final z2 = x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:96:11: Error: The class 'AbstractClassWithConstructor' is abstract and can't be instantiated.
+// const AbstractClassWithConstructor();
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:96:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const AbstractClassWithConstructor();
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:168:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const ClassWithNonEmptyConstConstructor();
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:114:7: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+// class ExtendsFoo1 extends Foo {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+abstract class AbstractClass extends core::Object {
+ synthetic constructor •() → self::AbstractClass*
+ : 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
+}
+abstract class AbstractClassWithConstructor extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::AbstractClassWithConstructor*
+ : super core::Object::•()
+ ;
+ abstract method foo() → core::int*;
+ 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 NotAbstractClass extends core::Object {
+ @invalid-expression "Constant evaluation has no support for Throw!"
+ field core::Object* foo = null;
+ @invalid-expression "Constant evaluation has no support for Throw!"
+ field core::Object* bar = null;
+ synthetic constructor •() → self::NotAbstractClass*
+ : 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 Foo extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x;
+ final field core::int* y;
+ const constructor •(core::int* x) → self::Foo*
+ : self::Foo::x = x, self::Foo::y = "hello".{core::String::length}, 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 ExtendsFoo1 extends self::Foo {
+ synthetic constructor •() → self::ExtendsFoo1*
+ : invalid-initializer
+ ;
+}
+class ExtendsFoo2 extends self::Foo /*hasConstConstructor*/ {
+ const constructor •() → self::ExtendsFoo2*
+ : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+ const ExtendsFoo2();
+ ^^^^^^^^^^^"
+ ;
+}
+class ConstClassWithFailingAssertWithEmptyMessage extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::ConstClassWithFailingAssertWithEmptyMessage*
+ : assert(false, ""), 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 ClassWithTypeArguments<E extends core::Object* = dynamic, F extends core::Object* = dynamic, G extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ const constructor •(self::ClassWithTypeArguments::E* e, self::ClassWithTypeArguments::F* f, self::ClassWithTypeArguments::G* g) → self::ClassWithTypeArguments<self::ClassWithTypeArguments::E*, self::ClassWithTypeArguments::F*, self::ClassWithTypeArguments::G*>*
+ : 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 ClassWithNonEmptyConstConstructor extends core::Object {
+ constructor •() → self::ClassWithNonEmptyConstConstructor*
+ : super core::Object::•() {
+ core::print("hello");
+ }
+ 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 ConstClassWithFinalFields1 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x = 1;
+ const constructor •() → self::ConstClassWithFinalFields1*
+ : 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 ConstClassWithFinalFields2 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* y = 1;
+ final field dynamic z1 = this.{self::ConstClassWithFinalFields2::y};
+ final field core::int* z2 = self::x;
+ const constructor •() → self::ConstClassWithFinalFields2*
+ : 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 core::bool* barFromEnv = #C1;
+static const field core::bool* hasBarEnv = #C1;
+static const field core::bool* barFromEnvOrNull = #C2;
+static const field core::bool* notBarFromEnvOrNull = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'.";
+static const field core::bool* conditionalOnNull = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'.";
+static const field core::bool* nullAwareOnNullTrue = #C3;
+static const field core::bool* nullAwareOnNullFalse = #C1;
+static const field core::bool* andOnFalse = #C1;
+static const field core::bool* andOnFalse2 = #C1;
+static const field core::bool* andOnNull = invalid-expression "The method '&&' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* andOnNull2 = invalid-expression "Binary operator '&&' on 'true' requires operand of type 'bool', but was of type 'Null'.";
+static const field core::bool* orOnNull = invalid-expression "The method '||' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* orOnNull2 = invalid-expression "The method '||' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* orOnNull3 = #C3;
+static const field core::bool* orOnNull4 = invalid-expression "Binary operator '||' on 'false' requires operand of type 'bool', but was of type 'Null'.";
+static const field core::String* barFromEnvString = #C4;
+static const field core::String* barFromEnvOrNullString = #C2;
+static const field core::String* barFromEnvOrActualString = #C5;
+static const field core::String* nullFromEnvString = invalid-expression "Null value during constant evaluation.";
+static const field core::bool* barFromEnvBool = #C1;
+static const field core::bool* barFromEnvOrNullBool = #C2;
+static const field core::bool* barFromEnvOrActualBool = #C3;
+static const field core::bool* nullFromEnvBool = invalid-expression "Null value during constant evaluation.";
+static const field core::int* barFromEnvInt = #C6;
+static const field core::int* barFromEnvOrNullInt = #C2;
+static const field core::int* barFromEnvOrActualInt = #C7;
+static const field core::int* nullFromEnvInt = invalid-expression "Null value during constant evaluation.";
+static const field core::bool* bazFromEnv = #C1;
+static const field core::bool* hasBazEnv = #C3;
+static const field core::int* bazFromEnvAsInt = #C7;
+static const field core::String* bazFromEnvAsString = #C8;
+static const field core::bool* bazTrueFromEnv = #C3;
+static const field core::bool* bazFalseFromEnv = #C1;
+static const field core::bool* trueBool = #C3;
+static const field core::bool* falseBool = #C1;
+static const field core::bool* binaryOnBoolCaret = #C3;
+static const field core::bool* binaryOnBoolAmpersand = #C1;
+static const field core::bool* binaryOnBoolBar = #C3;
+static const field core::bool* binaryOnBoolBar2 = #C3;
+static const field dynamic willBeDouble = #C9;
+static const field dynamic binaryOnDouble = invalid-expression "Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.";
+static const field dynamic willBeInt = #C7;
+static const field dynamic binaryOnIntWithDoubleBad = invalid-expression "Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.";
+static const field dynamic binaryOnIntWithDoubleOK = #C10;
+static const field dynamic binaryOnIntWithString = invalid-expression "Binary operator '<<' on '42' requires operand of type 'num', but was of type 'String'.";
+static const field dynamic willBeString = #C5;
+static const field dynamic binaryOnStringWithStringOK = #C11;
+static const field dynamic binaryOnStringWithInt = invalid-expression "Binary operator '+' on '\"hello\"' requires operand of type 'String', but was of type 'int'.";
+static const field dynamic binaryOnStringWithStringBad = invalid-expression "The method '-' can't be invoked on '\"hello\"' in a constant expression.";
+static field core::int* x = 1;
+static const field core::int* x1 = invalid-expression "Constant evaluation has no support for StaticSet!";
+static const field core::int* x2 = invalid-expression "Constant evaluation has no support for StaticSet!";
+static const field core::int* x3 = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::int* x4 = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::int* y = #C12;
+static const field dynamic y1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+const y1 = --y;
+ ^";
+static const field dynamic y2 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+const y2 = ++y;
+ ^";
+static const field core::int* y3 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+const y3 = y--;
+ ^";
+static const field core::int* y4 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+const y4 = y++;
+ ^";
+static field self::AbstractClassWithConstructor* abstractClassWithConstructor = throw invalid-expression "pkg/front_end/testcases/general/constants/various.dart:96:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const AbstractClassWithConstructor();
+ ^";
+static const field self::ExtendsFoo1* extendsFoo1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+ ^^^^^^^^^^^";
+static const field self::ExtendsFoo2* extendsFoo2 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+ const ExtendsFoo2();
+ ^^^^^^^^^^^";
+static const field self::Foo* foo1 = #C14;
+static const field self::Foo* foo2 = #C14;
+static const field core::bool* foosIdentical = #C3;
+static const field core::bool* foosEqual = invalid-expression "Binary operator '==' requires receiver constant 'Foo {x: 42, y: 5}' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/general/constants/various.dart'.";
+static const field core::Symbol* barFoo = #C15;
+static const field core::Symbol* barFooEqual = #C16;
+static const field core::Symbol* tripleShiftSymbol = #C17;
+static const field core::Symbol* symbolWithDots = #C18;
+static const field core::int* circularity1 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity2 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity3 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity4 = invalid-expression "Constant expression depends on itself.";
+static const field dynamic function_const = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+const function_const = () {};
+ ^^";
+static field () →* core::Null? function_var = () → core::Null? {};
+static field self::ConstClassWithFailingAssertWithEmptyMessage* failedAssertEmptyMessage = invalid-expression "This assertion failed with message: (empty)";
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments1 = #C19;
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments2 = #C20;
+static const field core::bool* classWithTypeArgumentsIdentical = #C1;
+static field self::ClassWithNonEmptyConstConstructor* classWithNonEmptyConstConstructor = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:168:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const ClassWithNonEmptyConstConstructor();
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" as{TypeError,ForDynamic} self::ClassWithNonEmptyConstConstructor*;
+static field self::ConstClassWithFinalFields2* constClassWithFinalFields = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::bool* zeroPointZeroIdentical = #C3;
+static const field core::bool* zeroPointZeroIdenticalToZero = #C1;
+static const field core::bool* zeroIdenticalToZeroPointZero = #C1;
+static const field core::bool* nanIdentical = #C3;
+static const field core::bool* zeroPointZeroEqual = #C3;
+static const field core::bool* zeroPointZeroEqualToZero = #C3;
+static const field core::bool* zeroEqualToZeroPointZero = #C3;
+static const field core::bool* nanEqual = #C1;
+static const field dynamic willBecomeNull = #C2;
+static const field (core::int*) →* core::int* willBecomeNullToo = #C2;
+static const field (core::int*) →* core::int* partialInstantiation = #C22;
+static const field core::bool* yBool = #C3;
+static const field core::bool* zBool = #C1;
+static const field core::Object* maybeInt = #C3;
+static const field core::bool* isItInt = #C1;
+static const field core::Object* maybeInt2 = #C3;
+static const field core::bool* isItInt2 = #C1;
+static const field core::int* maybeInt3 = #C2;
+static const field core::bool* isItInt3 = #C1;
+static method id1<T extends core::Object* = dynamic>(self::id1::T* t) → self::id1::T*
+ return t;
+static method id2<T extends core::Object* = dynamic>(self::id2::T* t) → self::id2::T*
+ return t;
+static method main() → dynamic {
+ core::print(#C1);
+ core::print(#C1);
+}
+
+constants {
+ #C1 = false
+ #C2 = null
+ #C3 = true
+ #C4 = ""
+ #C5 = "hello"
+ #C6 = 0
+ #C7 = 42
+ #C8 = "42"
+ #C9 = 42.42
+ #C10 = 84.42
+ #C11 = "hello world"
+ #C12 = 1
+ #C13 = 5
+ #C14 = self::Foo {x:#C7, y:#C13}
+ #C15 = #Foo
+ #C16 = #Foo=
+ #C17 = #>>>
+ #C18 = #I.Have.Dots
+ #C19 = self::ClassWithTypeArguments<core::int*, core::int*, core::int*> {}
+ #C20 = self::ClassWithTypeArguments<dynamic, dynamic, dynamic> {}
+ #C21 = tearoff self::id1
+ #C22 = partial-instantiation self::id1 <core::int*>
+}
diff --git a/pkg/front_end/testcases/general/constants/various.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/various.dart.strong.transformed.expect
new file mode 100644
index 0000000..d5a8efb
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart.strong.transformed.expect
@@ -0,0 +1,629 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/various.dart:10:34: Error: Constant evaluation error:
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:10:34: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'.
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:10:12: Context: While analyzing:
+// const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:11:49: Error: Constant evaluation error:
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:11:32: Context: Expected constant 'null' to be of type 'bool', but was of type 'Null'.
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:11:12: Context: While analyzing:
+// const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:16:41: Error: Constant evaluation error:
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:16:41: Context: The method '&&' can't be invoked on 'null' in a constant expression.
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:16:12: Context: While analyzing:
+// const bool andOnNull = barFromEnvOrNull && true;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:17:30: Error: Constant evaluation error:
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:17:30: Context: Binary operator '&&' on 'true' requires operand of type 'bool', but was of type 'Null'.
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:17:12: Context: While analyzing:
+// const bool andOnNull2 = true && barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:18:40: Error: Constant evaluation error:
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:18:40: Context: The method '||' can't be invoked on 'null' in a constant expression.
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:18:12: Context: While analyzing:
+// const bool orOnNull = barFromEnvOrNull || true;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:19:41: Error: Constant evaluation error:
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:19:41: Context: The method '||' can't be invoked on 'null' in a constant expression.
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:19:12: Context: While analyzing:
+// const bool orOnNull2 = barFromEnvOrNull || false;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:21:30: Error: Constant evaluation error:
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:21:30: Context: Binary operator '||' on 'false' requires operand of type 'bool', but was of type 'Null'.
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:21:12: Context: While analyzing:
+// const bool orOnNull4 = false || barFromEnvOrNull;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:29:11: Error: Constant evaluation error:
+// const String.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:29:11: Context: Null value during constant evaluation.
+// const String.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:28:14: Context: While analyzing:
+// const String nullFromEnvString =
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:36:36: Error: Constant evaluation error:
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:36:36: Context: Null value during constant evaluation.
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:36:12: Context: While analyzing:
+// const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:43:34: Error: Constant evaluation error:
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:43:34: Context: Null value during constant evaluation.
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:43:11: Context: While analyzing:
+// const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:64:37: Error: Constant evaluation error:
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:64:37: Context: Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:64:7: Context: While analyzing:
+// const binaryOnDouble = willBeDouble << 2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:66:44: Error: Constant evaluation error:
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:66:44: Context: Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:66:7: Context: While analyzing:
+// const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:68:41: Error: Constant evaluation error:
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:68:41: Context: Binary operator '<<' on '42' requires operand of type 'num', but was of type 'String'.
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:68:7: Context: While analyzing:
+// const binaryOnIntWithString = willBeInt << "hello";
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:72:44: Error: Constant evaluation error:
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:72:44: Context: Binary operator '+' on '"hello"' requires operand of type 'String', but was of type 'int'.
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:72:7: Context: While analyzing:
+// const binaryOnStringWithInt = willBeString + willBeInt;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:73:50: Error: Constant evaluation error:
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:73:50: Context: The method '-' can't be invoked on '"hello"' in a constant expression.
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:73:7: Context: While analyzing:
+// const binaryOnStringWithStringBad = willBeString - " world";
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:78:13: Error: Constant evaluation error:
+// const x3 = x--;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:78:12: Context: The invocation of 'x' is not allowed in a constant expression.
+// const x3 = x--;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:78:7: Context: While analyzing:
+// const x3 = x--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:79:13: Error: Constant evaluation error:
+// const x4 = x++;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:79:12: Context: The invocation of 'x' is not allowed in a constant expression.
+// const x4 = x++;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:79:7: Context: While analyzing:
+// const x4 = x++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:129:29: Error: Constant evaluation error:
+// const bool foosEqual = foo1 == foo2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:129:29: Context: Binary operator '==' requires receiver constant 'Foo {x: 42, y: 5}' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type 'Foo'.
+// - 'Foo' is from 'pkg/front_end/testcases/general/constants/various.dart'.
+// const bool foosEqual = foo1 == foo2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:129:12: Context: While analyzing:
+// const bool foosEqual = foo1 == foo2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:135:26: Error: Constant evaluation error:
+// const int circularity1 = circularity2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:135:26: Context: Constant expression depends on itself.
+// const int circularity1 = circularity2;
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:135:11: Context: While analyzing:
+// const int circularity1 = circularity2;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:148:11: Error: Constant evaluation error:
+// const ConstClassWithFailingAssertWithEmptyMessage();
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:144:64: Context: This assertion failed with message: (empty)
+// const ConstClassWithFailingAssertWithEmptyMessage() : assert(false, "");
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:185:11: Error: Constant evaluation error:
+// const ConstClassWithFinalFields2();
+// ^
+// pkg/front_end/testcases/general/constants/various.dart:181:14: Context: The invocation of 'x' is not allowed in a constant expression.
+// final z2 = x;
+// ^
+//
+library;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/various.dart:162:3: Error: A const constructor can't have a body.
+// Try removing either the 'const' keyword or the body.
+// const ClassWithNonEmptyConstConstructor() {
+// ^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:76:14: Error: Not a constant expression.
+// const x1 = --x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:77:14: Error: Not a constant expression.
+// const x2 = ++x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:78:12: Error: Not a constant expression.
+// const x3 = x--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:79:12: Error: Not a constant expression.
+// const x4 = x++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+// const y1 = --y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+// const y2 = ++y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+// const y3 = y--;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+// const y4 = y++;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+// const function_const = () {};
+// ^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Can't access 'this' in a field initializer to read 'y'.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: The class 'AbstractClass' is abstract and can't be instantiated.
+// @AbstractClass()
+// ^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:99:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClass()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: The class 'AbstractClassWithConstructor' is abstract and can't be instantiated.
+// @AbstractClassWithConstructor()
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:102:4: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// @AbstractClassWithConstructor()
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+// const ExtendsFoo2();
+// ^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:180:14: Error: Not a constant expression.
+// final z1 = y;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:181:14: Error: Not a constant expression.
+// final z2 = x;
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:96:11: Error: The class 'AbstractClassWithConstructor' is abstract and can't be instantiated.
+// const AbstractClassWithConstructor();
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:96:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const AbstractClassWithConstructor();
+// ^
+//
+// pkg/front_end/testcases/general/constants/various.dart:168:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+// Try using a constructor or factory that is 'const'.
+// const ClassWithNonEmptyConstConstructor();
+// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+//
+// pkg/front_end/testcases/general/constants/various.dart:114:7: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+// class ExtendsFoo1 extends Foo {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+import "dart:_internal" as _in;
+
+abstract class AbstractClass extends core::Object {
+ synthetic constructor •() → self::AbstractClass*
+ : 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
+}
+abstract class AbstractClassWithConstructor extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::AbstractClassWithConstructor*
+ : super core::Object::•()
+ ;
+ abstract method foo() → core::int*;
+ 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 NotAbstractClass extends core::Object {
+ @invalid-expression "Constant evaluation has no support for Throw!"
+ field core::Object* foo = null;
+ @invalid-expression "Constant evaluation has no support for Throw!"
+ field core::Object* bar = null;
+ synthetic constructor •() → self::NotAbstractClass*
+ : 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 Foo extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x;
+ final field core::int* y;
+ const constructor •(core::int* x) → self::Foo*
+ : self::Foo::x = x, self::Foo::y = "hello".{core::String::length}, 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 ExtendsFoo1 extends self::Foo {
+ synthetic constructor •() → self::ExtendsFoo1*
+ : invalid-initializer
+ ;
+}
+class ExtendsFoo2 extends self::Foo /*hasConstConstructor*/ {
+ const constructor •() → self::ExtendsFoo2*
+ : final dynamic #t1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+ const ExtendsFoo2();
+ ^^^^^^^^^^^"
+ ;
+}
+class ConstClassWithFailingAssertWithEmptyMessage extends core::Object /*hasConstConstructor*/ {
+ const constructor •() → self::ConstClassWithFailingAssertWithEmptyMessage*
+ : assert(false, ""), 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 ClassWithTypeArguments<E extends core::Object* = dynamic, F extends core::Object* = dynamic, G extends core::Object* = dynamic> extends core::Object /*hasConstConstructor*/ {
+ const constructor •(self::ClassWithTypeArguments::E* e, self::ClassWithTypeArguments::F* f, self::ClassWithTypeArguments::G* g) → self::ClassWithTypeArguments<self::ClassWithTypeArguments::E*, self::ClassWithTypeArguments::F*, self::ClassWithTypeArguments::G*>*
+ : 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 ClassWithNonEmptyConstConstructor extends core::Object {
+ constructor •() → self::ClassWithNonEmptyConstConstructor*
+ : super core::Object::•() {
+ core::print("hello");
+ }
+ 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 ConstClassWithFinalFields1 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* x = 1;
+ const constructor •() → self::ConstClassWithFinalFields1*
+ : 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 ConstClassWithFinalFields2 extends core::Object /*hasConstConstructor*/ {
+ final field core::int* y = 1;
+ final field dynamic z1 = this.{self::ConstClassWithFinalFields2::y};
+ final field core::int* z2 = self::x;
+ const constructor •() → self::ConstClassWithFinalFields2*
+ : 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 core::bool* barFromEnv = #C1;
+static const field core::bool* hasBarEnv = #C1;
+static const field core::bool* barFromEnvOrNull = #C2;
+static const field core::bool* notBarFromEnvOrNull = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'.";
+static const field core::bool* conditionalOnNull = invalid-expression "Expected constant 'null' to be of type 'bool', but was of type 'Null'.";
+static const field core::bool* nullAwareOnNullTrue = #C3;
+static const field core::bool* nullAwareOnNullFalse = #C1;
+static const field core::bool* andOnFalse = #C1;
+static const field core::bool* andOnFalse2 = #C1;
+static const field core::bool* andOnNull = invalid-expression "The method '&&' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* andOnNull2 = invalid-expression "Binary operator '&&' on 'true' requires operand of type 'bool', but was of type 'Null'.";
+static const field core::bool* orOnNull = invalid-expression "The method '||' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* orOnNull2 = invalid-expression "The method '||' can't be invoked on 'null' in a constant expression.";
+static const field core::bool* orOnNull3 = #C3;
+static const field core::bool* orOnNull4 = invalid-expression "Binary operator '||' on 'false' requires operand of type 'bool', but was of type 'Null'.";
+static const field core::String* barFromEnvString = #C4;
+static const field core::String* barFromEnvOrNullString = #C2;
+static const field core::String* barFromEnvOrActualString = #C5;
+static const field core::String* nullFromEnvString = invalid-expression "Null value during constant evaluation.";
+static const field core::bool* barFromEnvBool = #C1;
+static const field core::bool* barFromEnvOrNullBool = #C2;
+static const field core::bool* barFromEnvOrActualBool = #C3;
+static const field core::bool* nullFromEnvBool = invalid-expression "Null value during constant evaluation.";
+static const field core::int* barFromEnvInt = #C6;
+static const field core::int* barFromEnvOrNullInt = #C2;
+static const field core::int* barFromEnvOrActualInt = #C7;
+static const field core::int* nullFromEnvInt = invalid-expression "Null value during constant evaluation.";
+static const field core::bool* bazFromEnv = #C1;
+static const field core::bool* hasBazEnv = #C3;
+static const field core::int* bazFromEnvAsInt = #C7;
+static const field core::String* bazFromEnvAsString = #C8;
+static const field core::bool* bazTrueFromEnv = #C3;
+static const field core::bool* bazFalseFromEnv = #C1;
+static const field core::bool* trueBool = #C3;
+static const field core::bool* falseBool = #C1;
+static const field core::bool* binaryOnBoolCaret = #C3;
+static const field core::bool* binaryOnBoolAmpersand = #C1;
+static const field core::bool* binaryOnBoolBar = #C3;
+static const field core::bool* binaryOnBoolBar2 = #C3;
+static const field dynamic willBeDouble = #C9;
+static const field dynamic binaryOnDouble = invalid-expression "Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.";
+static const field dynamic willBeInt = #C7;
+static const field dynamic binaryOnIntWithDoubleBad = invalid-expression "Binary operator '<<' on '42.42' requires operand of type 'int', but was of type 'double'.";
+static const field dynamic binaryOnIntWithDoubleOK = #C10;
+static const field dynamic binaryOnIntWithString = invalid-expression "Binary operator '<<' on '42' requires operand of type 'num', but was of type 'String'.";
+static const field dynamic willBeString = #C5;
+static const field dynamic binaryOnStringWithStringOK = #C11;
+static const field dynamic binaryOnStringWithInt = invalid-expression "Binary operator '+' on '\"hello\"' requires operand of type 'String', but was of type 'int'.";
+static const field dynamic binaryOnStringWithStringBad = invalid-expression "The method '-' can't be invoked on '\"hello\"' in a constant expression.";
+static field core::int* x = 1;
+static const field core::int* x1 = invalid-expression "Constant evaluation has no support for StaticSet!";
+static const field core::int* x2 = invalid-expression "Constant evaluation has no support for StaticSet!";
+static const field core::int* x3 = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::int* x4 = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::int* y = #C12;
+static const field dynamic y1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:82:14: Error: Setter not found: 'y'.
+const y1 = --y;
+ ^";
+static const field dynamic y2 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:83:14: Error: Setter not found: 'y'.
+const y2 = ++y;
+ ^";
+static const field core::int* y3 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:84:12: Error: Setter not found: 'y'.
+const y3 = y--;
+ ^";
+static const field core::int* y4 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:85:12: Error: Setter not found: 'y'.
+const y4 = y++;
+ ^";
+static field self::AbstractClassWithConstructor* abstractClassWithConstructor = throw invalid-expression "pkg/front_end/testcases/general/constants/various.dart:96:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const AbstractClassWithConstructor();
+ ^";
+static const field self::ExtendsFoo1* extendsFoo1 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:118:39: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+ ^^^^^^^^^^^";
+static const field self::ExtendsFoo2* extendsFoo2 = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:121:9: Error: The superclass, 'Foo', has no unnamed constructor that takes no arguments.
+ const ExtendsFoo2();
+ ^^^^^^^^^^^";
+static const field self::Foo* foo1 = #C14;
+static const field self::Foo* foo2 = #C14;
+static const field core::bool* foosIdentical = #C3;
+static const field core::bool* foosEqual = invalid-expression "Binary operator '==' requires receiver constant 'Foo {x: 42, y: 5}' of type 'Null', 'bool', 'int', 'double', or 'String', but was of type 'Foo'.
+ - 'Foo' is from 'pkg/front_end/testcases/general/constants/various.dart'.";
+static const field core::Symbol* barFoo = #C15;
+static const field core::Symbol* barFooEqual = #C16;
+static const field core::Symbol* tripleShiftSymbol = #C17;
+static const field core::Symbol* symbolWithDots = #C18;
+static const field core::int* circularity1 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity2 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity3 = invalid-expression "Constant expression depends on itself.";
+static const field core::int* circularity4 = invalid-expression "Constant expression depends on itself.";
+static const field dynamic function_const = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:140:24: Error: Not a constant expression.
+const function_const = () {};
+ ^^";
+static field () →* core::Null? function_var = () → core::Null? {};
+static field self::ConstClassWithFailingAssertWithEmptyMessage* failedAssertEmptyMessage = invalid-expression "This assertion failed with message: (empty)";
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments1 = #C19;
+static const field self::ClassWithTypeArguments<dynamic, dynamic, dynamic>* classWithTypeArguments2 = #C20;
+static const field core::bool* classWithTypeArgumentsIdentical = #C1;
+static field self::ClassWithNonEmptyConstConstructor* classWithNonEmptyConstConstructor = invalid-expression "pkg/front_end/testcases/general/constants/various.dart:168:11: Error: Cannot invoke a non-'const' constructor where a const expression is expected.
+Try using a constructor or factory that is 'const'.
+ const ClassWithNonEmptyConstConstructor();
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
+static field self::ConstClassWithFinalFields2* constClassWithFinalFields = invalid-expression "The invocation of 'x' is not allowed in a constant expression.";
+static const field core::bool* zeroPointZeroIdentical = #C3;
+static const field core::bool* zeroPointZeroIdenticalToZero = #C1;
+static const field core::bool* zeroIdenticalToZeroPointZero = #C1;
+static const field core::bool* nanIdentical = #C3;
+static const field core::bool* zeroPointZeroEqual = #C3;
+static const field core::bool* zeroPointZeroEqualToZero = #C3;
+static const field core::bool* zeroEqualToZeroPointZero = #C3;
+static const field core::bool* nanEqual = #C1;
+static const field dynamic willBecomeNull = #C2;
+static const field (core::int*) →* core::int* willBecomeNullToo = #C2;
+static const field (core::int*) →* core::int* partialInstantiation = #C22;
+static const field core::bool* yBool = #C3;
+static const field core::bool* zBool = #C1;
+static const field core::Object* maybeInt = #C3;
+static const field core::bool* isItInt = #C1;
+static const field core::Object* maybeInt2 = #C3;
+static const field core::bool* isItInt2 = #C1;
+static const field core::int* maybeInt3 = #C2;
+static const field core::bool* isItInt3 = #C1;
+static method id1<T extends core::Object* = dynamic>(self::id1::T* t) → self::id1::T*
+ return t;
+static method id2<T extends core::Object* = dynamic>(self::id2::T* t) → self::id2::T*
+ return t;
+static method main() → dynamic {
+ core::print(#C1);
+ core::print(#C1);
+}
+
+constants {
+ #C1 = false
+ #C2 = null
+ #C3 = true
+ #C4 = ""
+ #C5 = "hello"
+ #C6 = 0
+ #C7 = 42
+ #C8 = "42"
+ #C9 = 42.42
+ #C10 = 84.42
+ #C11 = "hello world"
+ #C12 = 1
+ #C13 = 5
+ #C14 = self::Foo {x:#C7, y:#C13}
+ #C15 = #Foo
+ #C16 = #Foo=
+ #C17 = #>>>
+ #C18 = #I.Have.Dots
+ #C19 = self::ClassWithTypeArguments<core::int*, core::int*, core::int*> {}
+ #C20 = self::ClassWithTypeArguments<dynamic, dynamic, dynamic> {}
+ #C21 = tearoff self::id1
+ #C22 = partial-instantiation self::id1 <core::int*>
+}
diff --git a/pkg/front_end/testcases/general/constants/various.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/various.dart.textual_outline.expect
new file mode 100644
index 0000000..f696546
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart.textual_outline.expect
@@ -0,0 +1,143 @@
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const bool barFromEnvOrNull = const bool.fromEnvironment("bar", defaultValue: null);
+const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+const bool nullAwareOnNullTrue = barFromEnvOrNull ?? true;
+const bool nullAwareOnNullFalse = barFromEnvOrNull ?? false;
+const bool andOnFalse = nullAwareOnNullFalse && nullAwareOnNullTrue;
+const bool andOnFalse2 = nullAwareOnNullTrue && nullAwareOnNullFalse;
+const bool andOnNull = barFromEnvOrNull && true;
+const bool andOnNull2 = true && barFromEnvOrNull;
+const bool orOnNull = barFromEnvOrNull || true;
+const bool orOnNull2 = barFromEnvOrNull || false;
+const bool orOnNull3 = true || barFromEnvOrNull;
+const bool orOnNull4 = false || barFromEnvOrNull;
+const String barFromEnvString = const String.fromEnvironment("bar");
+const String barFromEnvOrNullString = const String.fromEnvironment("bar", defaultValue: null);
+const String barFromEnvOrActualString = const String.fromEnvironment("bar", defaultValue: "hello");
+const String nullFromEnvString = const String.fromEnvironment(barFromEnvOrNullString);
+const bool barFromEnvBool = const bool.fromEnvironment("bar");
+const bool barFromEnvOrNullBool = const bool.fromEnvironment("bar", defaultValue: null);
+const bool barFromEnvOrActualBool = const bool.fromEnvironment("bar", defaultValue: true);
+const bool nullFromEnvBool = const bool.fromEnvironment(barFromEnvOrNullString);
+const int barFromEnvInt = const int.fromEnvironment("bar");
+const int barFromEnvOrNullInt = const int.fromEnvironment("bar", defaultValue: null);
+const int barFromEnvOrActualInt = const int.fromEnvironment("bar", defaultValue: 42);
+const int nullFromEnvInt = const int.fromEnvironment(barFromEnvOrNullString);
+const bool bazFromEnv = const bool.fromEnvironment("baz");
+const bool hasBazEnv = const bool.hasEnvironment("baz");
+const int bazFromEnvAsInt = const int.fromEnvironment("baz");
+const String bazFromEnvAsString = const String.fromEnvironment("baz");
+const bool bazTrueFromEnv = const bool.fromEnvironment("bazTrue");
+const bool bazFalseFromEnv = const bool.fromEnvironment("bazFalse");
+const bool trueBool = true;
+const bool falseBool = false;
+const bool binaryOnBoolCaret = trueBool ^ falseBool;
+const bool binaryOnBoolAmpersand = trueBool & falseBool;
+const bool binaryOnBoolBar = trueBool | falseBool;
+const bool binaryOnBoolBar2 = falseBool | trueBool;
+const dynamic willBeDouble = const bool.fromEnvironment("foo") ? 42 : 42.42;
+const binaryOnDouble = willBeDouble << 2;
+const dynamic willBeInt = const bool.fromEnvironment("foo") ? 42.42 : 42;
+const binaryOnIntWithDoubleBad = willBeInt << willBeDouble;
+const binaryOnIntWithDoubleOK = willBeInt + willBeDouble;
+const binaryOnIntWithString = willBeInt << "hello";
+const dynamic willBeString = const bool.fromEnvironment("foo") ? 42.42 : "hello";
+const binaryOnStringWithStringOK = willBeString + " world";
+const binaryOnStringWithInt = willBeString + willBeInt;
+const binaryOnStringWithStringBad = willBeString - " world";
+var x = 1;
+const x1 = --x;
+const x2 = ++x;
+const x3 = x--;
+const x4 = x++;
+const y = 1;
+const y1 = --y;
+const y2 = ++y;
+const y3 = y--;
+const y4 = y++;
+abstract class AbstractClass {}
+abstract class AbstractClassWithConstructor {
+ const AbstractClassWithConstructor();
+ int foo();
+}
+AbstractClassWithConstructor abstractClassWithConstructor = const AbstractClassWithConstructor();
+class NotAbstractClass {
+ @AbstractClass()
+ Object foo;
+ @AbstractClassWithConstructor()
+ Object bar;
+}
+class Foo {
+ final int x;
+ final int y;
+ const Foo(int x) : this.x = x, this.y = "hello".length;
+}
+class ExtendsFoo1 extends Foo {}
+const ExtendsFoo1 extendsFoo1 = const ExtendsFoo1();
+class ExtendsFoo2 extends Foo {
+ const ExtendsFoo2();
+}
+const ExtendsFoo2 extendsFoo2 = const ExtendsFoo2();
+const Foo foo1 = const Foo(42);
+const Foo foo2 = const Foo(42);
+const bool foosIdentical = identical(foo1, foo2);
+const bool foosEqual = foo1 == foo2;
+const Symbol barFoo = const Symbol("Foo");
+const Symbol barFooEqual = const Symbol("Foo=");
+const Symbol tripleShiftSymbol = const Symbol(">>>");
+const Symbol symbolWithDots = const Symbol("I.Have.Dots");
+const int circularity1 = circularity2;
+const int circularity2 = circularity3;
+const int circularity3 = circularity4;
+const int circularity4 = circularity1;
+const function_const = () {};
+var function_var = () {};
+class ConstClassWithFailingAssertWithEmptyMessage {
+ const ConstClassWithFailingAssertWithEmptyMessage() : assert(false, "");
+}
+ConstClassWithFailingAssertWithEmptyMessage failedAssertEmptyMessage = const ConstClassWithFailingAssertWithEmptyMessage();
+class ClassWithTypeArguments<E, F, G> {
+ const ClassWithTypeArguments(E e, F f, G g);
+}
+const ClassWithTypeArguments classWithTypeArguments1 = const ClassWithTypeArguments<int, int, int>(42, 42, 42);
+const ClassWithTypeArguments classWithTypeArguments2 = const ClassWithTypeArguments(42, 42, 42);
+const bool classWithTypeArgumentsIdentical = identical(classWithTypeArguments1, classWithTypeArguments2);
+class ClassWithNonEmptyConstConstructor {
+ const ClassWithNonEmptyConstConstructor() {}
+}
+ClassWithNonEmptyConstConstructor classWithNonEmptyConstConstructor = const ClassWithNonEmptyConstConstructor();
+class ConstClassWithFinalFields1 {
+ const ConstClassWithFinalFields1();
+ final x = 1;
+}
+class ConstClassWithFinalFields2 {
+ const ConstClassWithFinalFields2();
+ final y = 1;
+ final z1 = y;
+ final z2 = x;
+}
+ConstClassWithFinalFields2 constClassWithFinalFields = const ConstClassWithFinalFields2();
+const zeroPointZeroIdentical = identical(0.0, 0.0);
+const zeroPointZeroIdenticalToZero = identical(0.0, 0);
+const zeroIdenticalToZeroPointZero = identical(0, 0.0);
+const nanIdentical = identical(0 / 0, 0 / 0);
+const zeroPointZeroEqual = 0.0 == 0.0;
+const zeroPointZeroEqualToZero = 0.0 == 0;
+const zeroEqualToZeroPointZero = 0 == 0.0;
+const nanEqual = 0 / 0 == 0 / 0;
+T id1<T>(T t) => t;
+T id2<T>(T t) => t;
+const dynamic willBecomeNull = const bool.fromEnvironment("foo") ? id1 : null;
+const int Function(int) willBecomeNullToo = const bool.fromEnvironment("foo") ? id1 : willBecomeNull;
+const int Function(int) partialInstantiation = const bool.fromEnvironment("foo") ? willBecomeNull : id1;
+const bool yBool = true;
+const bool zBool = !yBool;
+const maybeInt = bool.fromEnvironment("foo") ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const maybeInt2 = zBool ? 42 : true;
+const bool isItInt2 = maybeInt2 is int ? true : false;
+const maybeInt3 = zBool ? 42 : null;
+const bool isItInt3 = maybeInt3 is int ? true : false;
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/various.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/various.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..068970b
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/various.dart.textual_outline_modelled.expect
@@ -0,0 +1,39 @@
+ConstClassWithFailingAssertWithEmptyMessage failedAssertEmptyMessage =
+ const ConstClassWithFailingAssertWithEmptyMessage();
+
+abstract class AbstractClass {}
+
+class ConstClassWithFailingAssertWithEmptyMessage {
+ const ConstClassWithFailingAssertWithEmptyMessage() : assert(false, "");
+}
+
+class Foo {
+ const Foo(int x)
+ : this.x = x,
+ this.y = "hello".length;
+ final int x;
+ final int y;
+}
+
+class NotAbstractClass {
+ @AbstractClass()
+ Object foo;
+}
+
+const Foo foo = const Foo(42);
+const Symbol barFoo = const Symbol("Foo");
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const function_const = () {};
+const x1 = --x;
+const x2 = ++x;
+const x3 = x--;
+const x4 = x++;
+const y = 1;
+const y1 = --y;
+const y2 = ++y;
+const y3 = y--;
+const y4 = y++;
+main() {}
+var function_var = () {};
+var x = 1;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart
new file mode 100644
index 0000000..473c73d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class Foo {
+ final int x;
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+}
+
+class Bar {
+ final int x;
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+}
+
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+
+main() {
+ print(foo1);
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.outline.expect
new file mode 100644
index 0000000..aca1a1b
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.outline.expect
@@ -0,0 +1,48 @@
+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
+ ;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.expect
new file mode 100644
index 0000000..9ad7ac5
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.expect
@@ -0,0 +1,130 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:26:24: Error: Constant evaluation error:
+// const Foo foo2 = const Foo(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/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/with_unevaluated_agnostic/const_asserts.dart:26:11: Context: While analyzing:
+// const Foo foo2 = const Foo(0);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:28:24: Error: Constant evaluation error:
+// const Foo foo4 = const Foo.withInvalidMessage(42);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:15: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/with_unevaluated_agnostic/const_asserts.dart:28:11: Context: While analyzing:
+// const Foo foo4 = const Foo.withInvalidMessage(42);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:30:24: Error: Constant evaluation error:
+// const Bar bar1 = const Bar.withMessage(1);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:21: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/with_unevaluated_agnostic/const_asserts.dart:30:11: Context: While analyzing:
+// const Bar bar1 = const Bar.withMessage(1);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:31:24: Error: Constant evaluation error:
+// const Bar bar2 = const Bar.withMessage(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:21: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/with_unevaluated_agnostic/const_asserts.dart:31:11: Context: While analyzing:
+// const Bar bar2 = const Bar.withMessage(0);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:32:24: Error: Constant evaluation error:
+// const Bar bar3 = const Bar.withoutMessage(1);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:22:47: Context: This assertion failed.
+// const Bar.withoutMessage(this.x) : assert(x < 0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:32:11: Context: While analyzing:
+// const Bar bar3 = const Bar.withoutMessage(1);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:33:24: Error: Constant evaluation error:
+// const Bar bar4 = const Bar.withoutMessage(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:22:47: Context: This assertion failed.
+// const Bar.withoutMessage(this.x) : assert(x < 0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:33:11: Context: While analyzing:
+// const Bar bar4 = const Bar.withoutMessage(0);
+// ^
+//
+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((#C2).{core::Object::==}(false), "foo was ${#C3}"), assert((#C4).{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 ${#C5}"), 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 = #C9;
+static const field self::Foo foo2 = invalid-expression "This assertion failed with message: x is not positive";
+static const field self::Foo foo3 = #C12;
+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/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);
+ ^";
+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 method main() → dynamic {
+ core::print(#C13);
+}
+
+constants {
+ #C1 = "foo"
+ #C2 = eval const core::bool::fromEnvironment(#C1)
+ #C3 = eval const core::bool::fromEnvironment(#C1)
+ #C4 = eval const core::bool::fromEnvironment(#C1)
+ #C5 = eval const core::bool::fromEnvironment(#C1)
+ #C6 = 1
+ #C7 = false
+ #C8 = "foo was "
+ #C9 = eval self::Foo{x:#C6, assert(const core::bool::fromEnvironment(#C1).==(#C7), "${#C8}${const core::bool::fromEnvironment(#C1)}"), assert(const core::bool::fromEnvironment(#C1).==(#C7))}
+ #C10 = 42
+ #C11 = "btw foo was "
+ #C12 = eval self::Foo{x:#C10, assert(#C7, "${#C11}${const core::bool::fromEnvironment(#C1)}")}
+ #C13 = eval self::Foo{x:#C6, assert(const core::bool::fromEnvironment(#C1).==(#C7), "${#C8}${const core::bool::fromEnvironment(#C1)}"), assert(const core::bool::fromEnvironment(#C1).==(#C7))}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.transformed.expect
new file mode 100644
index 0000000..9ad7ac5
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.strong.transformed.expect
@@ -0,0 +1,130 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:26:24: Error: Constant evaluation error:
+// const Foo foo2 = const Foo(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/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/with_unevaluated_agnostic/const_asserts.dart:26:11: Context: While analyzing:
+// const Foo foo2 = const Foo(0);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:28:24: Error: Constant evaluation error:
+// const Foo foo4 = const Foo.withInvalidMessage(42);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:15: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/with_unevaluated_agnostic/const_asserts.dart:28:11: Context: While analyzing:
+// const Foo foo4 = const Foo.withInvalidMessage(42);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:30:24: Error: Constant evaluation error:
+// const Bar bar1 = const Bar.withMessage(1);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:21: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/with_unevaluated_agnostic/const_asserts.dart:30:11: Context: While analyzing:
+// const Bar bar1 = const Bar.withMessage(1);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:31:24: Error: Constant evaluation error:
+// const Bar bar2 = const Bar.withMessage(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:21: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/with_unevaluated_agnostic/const_asserts.dart:31:11: Context: While analyzing:
+// const Bar bar2 = const Bar.withMessage(0);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:32:24: Error: Constant evaluation error:
+// const Bar bar3 = const Bar.withoutMessage(1);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:22:47: Context: This assertion failed.
+// const Bar.withoutMessage(this.x) : assert(x < 0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:32:11: Context: While analyzing:
+// const Bar bar3 = const Bar.withoutMessage(1);
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:33:24: Error: Constant evaluation error:
+// const Bar bar4 = const Bar.withoutMessage(0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:22:47: Context: This assertion failed.
+// const Bar.withoutMessage(this.x) : assert(x < 0);
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart:33:11: Context: While analyzing:
+// const Bar bar4 = const Bar.withoutMessage(0);
+// ^
+//
+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((#C2).{core::Object::==}(false), "foo was ${#C3}"), assert((#C4).{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 ${#C5}"), 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 = #C9;
+static const field self::Foo foo2 = invalid-expression "This assertion failed with message: x is not positive";
+static const field self::Foo foo3 = #C12;
+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/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);
+ ^";
+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 method main() → dynamic {
+ core::print(#C13);
+}
+
+constants {
+ #C1 = "foo"
+ #C2 = eval const core::bool::fromEnvironment(#C1)
+ #C3 = eval const core::bool::fromEnvironment(#C1)
+ #C4 = eval const core::bool::fromEnvironment(#C1)
+ #C5 = eval const core::bool::fromEnvironment(#C1)
+ #C6 = 1
+ #C7 = false
+ #C8 = "foo was "
+ #C9 = eval self::Foo{x:#C6, assert(const core::bool::fromEnvironment(#C1).==(#C7), "${#C8}${const core::bool::fromEnvironment(#C1)}"), assert(const core::bool::fromEnvironment(#C1).==(#C7))}
+ #C10 = 42
+ #C11 = "btw foo was "
+ #C12 = eval self::Foo{x:#C10, assert(#C7, "${#C11}${const core::bool::fromEnvironment(#C1)}")}
+ #C13 = eval self::Foo{x:#C6, assert(const core::bool::fromEnvironment(#C1).==(#C7), "${#C8}${const core::bool::fromEnvironment(#C1)}"), assert(const core::bool::fromEnvironment(#C1).==(#C7))}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline.expect
new file mode 100644
index 0000000..13faa29
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline.expect
@@ -0,0 +1,30 @@
+class Foo {
+ final int x;
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+}
+
+class Bar {
+ final int x;
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+}
+
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..0bde6d8
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_asserts.dart.textual_outline_modelled.expect
@@ -0,0 +1,30 @@
+class Bar {
+ const Bar.withMessage(this.x) : assert(x < 0, "x is not negative");
+ const Bar.withoutMessage(this.x) : assert(x < 0);
+ final int x;
+}
+
+class Foo {
+ const Foo(this.x)
+ : assert(x > 0, "x is not positive"),
+ assert(x > 0),
+ assert(const bool.fromEnvironment("foo") == false,
+ "foo was ${const bool.fromEnvironment("foo")}"),
+ assert(const bool.fromEnvironment("foo") == false);
+ const Foo.withInvalidCondition(this.x) : assert(x);
+ const Foo.withInvalidMessage(this.x) : assert(x < 0, x);
+ const Foo.withMessage(this.x)
+ : assert(x < 0, "btw foo was ${const bool.fromEnvironment("foo")}");
+ final int x;
+}
+
+const Bar bar1 = const Bar.withMessage(1);
+const Bar bar2 = const Bar.withMessage(0);
+const Bar bar3 = const Bar.withoutMessage(1);
+const Bar bar4 = const Bar.withoutMessage(0);
+const Foo foo1 = const Foo(1);
+const Foo foo2 = const Foo(0);
+const Foo foo3 = const Foo.withMessage(42);
+const Foo foo4 = const Foo.withInvalidMessage(42);
+const Foo foo5 = const Foo.withInvalidCondition(42);
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart
new file mode 100644
index 0000000..d96e7e1
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const List<bool> listWithUnevaluated = [
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+];
+const List<bool> listWithUnevaluatedSpread = [
+ true,
+ ...listWithUnevaluated,
+ false
+];
+
+const Set<bool> setWithUnevaluated = {
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+};
+const Set<bool> setWithUnevaluatedSpread = {true, ...setWithUnevaluated, false};
+
+const a = <int>[];
+const b = <int?>[];
+const setNotAgnosticOK = {a, b};
+
+const Map<bool> MapWithUnevaluated = {
+ bool.fromEnvironment("foo"): bool.fromEnvironment("bar"),
+};
+
+const mapNotAgnosticOK = {a: 0, b: 1};
+
+main() {
+ print(listWithUnevaluated);
+ print(listWithUnevaluatedSpread);
+ print(setWithUnevaluated);
+ print(setWithUnevaluatedSpread);
+ print({"hello"});
+ print(const {"hello"});
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.outline.expect
new file mode 100644
index 0000000..38e14b2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.outline.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
+// const Map<bool> MapWithUnevaluated = {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::bool> listWithUnevaluated = const <core::bool>[const core::bool::fromEnvironment("foo"), const core::bool::fromEnvironment("bar"), true];
+static const field core::List<core::bool> listWithUnevaluatedSpread = const <core::bool>[true] + self::listWithUnevaluated + const <core::bool>[false];
+static const field core::Set<core::bool> setWithUnevaluated = const <core::bool>{const core::bool::fromEnvironment("foo"), const core::bool::fromEnvironment("bar"), true};
+static const field core::Set<core::bool> setWithUnevaluatedSpread = const <core::bool>{true} + self::setWithUnevaluated + const <core::bool>{false};
+static const field core::List<core::int> a = const <core::int>[];
+static const field core::List<core::int?> b = const <core::int?>[];
+static const field core::Set<core::List<core::int?>> setNotAgnosticOK = const <core::List<core::int?>>{self::a, self::b};
+static const field invalid-type MapWithUnevaluated = const <core::bool, core::bool>{const core::bool::fromEnvironment("foo"): const core::bool::fromEnvironment("bar")};
+static const field core::Map<core::List<core::int?>, core::int> mapNotAgnosticOK = const <core::List<core::int?>, core::int>{self::a: 0, self::b: 1};
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.expect
new file mode 100644
index 0000000..83d7801
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.expect
@@ -0,0 +1,82 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:26: Error: Constant evaluation error:
+// const setNotAgnosticOK = {a, b};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:30: Context: Constant value is not strong/weak mode agnostic.
+// const setNotAgnosticOK = {a, b};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:7: Context: While analyzing:
+// const setNotAgnosticOK = {a, b};
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:26: Error: Constant evaluation error:
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:33: Context: Constant value is not strong/weak mode agnostic.
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:7: Context: While analyzing:
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
+// const Map<bool> MapWithUnevaluated = {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::bool> listWithUnevaluated = #C7;
+static const field core::List<core::bool> listWithUnevaluatedSpread = #C11;
+static const field core::Set<core::bool> setWithUnevaluated = #C15;
+static const field core::Set<core::bool> setWithUnevaluatedSpread = #C18;
+static const field core::List<core::int> a = #C19;
+static const field core::List<core::int?> b = #C20;
+static const field core::Set<core::List<core::int?>> setNotAgnosticOK = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static const field invalid-type MapWithUnevaluated = #C22;
+static const field core::Map<core::List<core::int?>, core::int> mapNotAgnosticOK = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {
+ core::print(#C23);
+ core::print(#C24);
+ core::print(#C25);
+ core::print(#C26);
+ core::print(<core::String>{"hello"});
+ core::print(#C28);
+}
+
+constants {
+ #C1 = <core::bool>[]
+ #C2 = <dynamic>[]
+ #C3 = "foo"
+ #C4 = "bar"
+ #C5 = true
+ #C6 = <dynamic>[#C5]
+ #C7 = eval #C1 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6
+ #C8 = <core::bool>[#C5]
+ #C9 = false
+ #C10 = <core::bool>[#C9]
+ #C11 = eval #C8 + #C1 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6 + #C10
+ #C12 = <core::bool>{}
+ #C13 = <dynamic>{}
+ #C14 = <dynamic>{#C5}
+ #C15 = eval #C12 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14
+ #C16 = <core::bool>{#C5}
+ #C17 = <core::bool>{#C9}
+ #C18 = eval #C16 + #C12 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14 + #C17
+ #C19 = <core::int>[]
+ #C20 = <core::int?>[]
+ #C21 = <core::bool, core::bool>{)
+ #C22 = eval #C21 + const <dynamic, dynamic>{const core::bool::fromEnvironment(#C3): const core::bool::fromEnvironment(#C4)}
+ #C23 = eval #C1 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6
+ #C24 = eval #C8 + #C1 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6 + #C10
+ #C25 = eval #C12 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14
+ #C26 = eval #C16 + #C12 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14 + #C17
+ #C27 = "hello"
+ #C28 = <core::String>{#C27}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.transformed.expect
new file mode 100644
index 0000000..ebc641d
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.strong.transformed.expect
@@ -0,0 +1,83 @@
+//
+// Problems in component:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:26: Error: Constant evaluation error:
+// const setNotAgnosticOK = {a, b};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:30: Context: Constant value is not strong/weak mode agnostic.
+// const setNotAgnosticOK = {a, b};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:25:7: Context: While analyzing:
+// const setNotAgnosticOK = {a, b};
+// ^
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:26: Error: Constant evaluation error:
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:33: Context: Constant value is not strong/weak mode agnostic.
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:31:7: Context: While analyzing:
+// const mapNotAgnosticOK = {a: 0, b: 1};
+// ^
+//
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart:27:7: Error: Expected 2 type arguments.
+// const Map<bool> MapWithUnevaluated = {
+// ^
+//
+import self as self;
+import "dart:core" as core;
+
+static const field core::List<core::bool> listWithUnevaluated = #C7;
+static const field core::List<core::bool> listWithUnevaluatedSpread = #C11;
+static const field core::Set<core::bool> setWithUnevaluated = #C15;
+static const field core::Set<core::bool> setWithUnevaluatedSpread = #C18;
+static const field core::List<core::int> a = #C19;
+static const field core::List<core::int?> b = #C20;
+static const field core::Set<core::List<core::int?>> setNotAgnosticOK = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static const field invalid-type MapWithUnevaluated = #C23;
+static const field core::Map<core::List<core::int?>, core::int> mapNotAgnosticOK = invalid-expression "Constant value is not strong/weak mode agnostic.";
+static method main() → dynamic {
+ core::print(#C24);
+ core::print(#C25);
+ core::print(#C26);
+ core::print(#C27);
+ core::print(<core::String>{"hello"});
+ core::print(#C29);
+}
+
+constants {
+ #C1 = <core::bool>[]
+ #C2 = <dynamic>[]
+ #C3 = "foo"
+ #C4 = "bar"
+ #C5 = true
+ #C6 = <dynamic>[#C5]
+ #C7 = eval #C1 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6
+ #C8 = <core::bool>[#C5]
+ #C9 = false
+ #C10 = <core::bool>[#C9]
+ #C11 = eval #C8 + #C1 + #C2 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6 + #C10
+ #C12 = <core::bool>{}
+ #C13 = <dynamic>{}
+ #C14 = <dynamic>{#C5}
+ #C15 = eval #C12 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14
+ #C16 = <core::bool>{#C5}
+ #C17 = <core::bool>{#C9}
+ #C18 = eval #C16 + #C12 + #C13 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14 + #C17
+ #C19 = <core::int>[]
+ #C20 = <core::int?>[]
+ #C21 = <core::bool, core::bool>{)
+ #C22 = <dynamic, dynamic>{)
+ #C23 = eval #C21 + #C22 + const <dynamic, dynamic>{const core::bool::fromEnvironment(#C3): const core::bool::fromEnvironment(#C4)}
+ #C24 = eval #C1 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6
+ #C25 = eval #C8 + #C1 + #C2 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C3)] + #C2 + #C2 + #C2 + const <dynamic>[const core::bool::fromEnvironment(#C4)] + #C6 + #C10
+ #C26 = eval #C12 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14
+ #C27 = eval #C16 + #C12 + #C13 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C3)} + #C13 + #C13 + #C13 + const <dynamic>{const core::bool::fromEnvironment(#C4)} + #C14 + #C17
+ #C28 = "hello"
+ #C29 = <core::String>{#C28}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline.expect
new file mode 100644
index 0000000..320e5f4
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline.expect
@@ -0,0 +1,24 @@
+const List<bool> listWithUnevaluated = [
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+];
+const List<bool> listWithUnevaluatedSpread = [
+ true,
+ ...listWithUnevaluated,
+ false
+];
+const Set<bool> setWithUnevaluated = {
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+};
+const Set<bool> setWithUnevaluatedSpread = {true, ...setWithUnevaluated, false};
+const a = <int>[];
+const b = <int?>[];
+const setNotAgnosticOK = {a, b};
+const Map<bool> MapWithUnevaluated = {
+ bool.fromEnvironment("foo"): bool.fromEnvironment("bar"),
+};
+const mapNotAgnosticOK = {a: 0, b: 1};
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..c3b5d78
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/const_collections.dart.textual_outline_modelled.expect
@@ -0,0 +1,24 @@
+const List<bool> listWithUnevaluated = [
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+];
+const List<bool> listWithUnevaluatedSpread = [
+ true,
+ ...listWithUnevaluated,
+ false
+];
+const Map<bool> MapWithUnevaluated = {
+ bool.fromEnvironment("foo"): bool.fromEnvironment("bar"),
+};
+const Set<bool> setWithUnevaluated = {
+ bool.fromEnvironment("foo"),
+ bool.fromEnvironment("bar"),
+ true,
+};
+const Set<bool> setWithUnevaluatedSpread = {true, ...setWithUnevaluated, false};
+const a = <int>[];
+const b = <int?>[];
+const mapNotAgnosticOK = {a: 0, b: 1};
+const setNotAgnosticOK = {a, b};
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/folder.options b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/folder.options
new file mode 100644
index 0000000..41f34dd
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/folder.options
@@ -0,0 +1,5 @@
+--no-defines
+--target=none
+--no-verify
+--nnbd-agnostic
+--enable-experiment=non-nullable,triple-shift
\ No newline at end of file
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart
new file mode 100644
index 0000000..f790c4e
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const int foo = 42 * 42;
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const blaSymbol = #_x;
+
+main() {
+ _x();
+ const bool.fromEnvironment("foo");
+ print(bar);
+}
+
+void _x() {
+ print(foo);
+ print(bar);
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.outline.expect
new file mode 100644
index 0000000..f0d7f92
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.outline.expect
@@ -0,0 +1,12 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int foo = 42.{core::num::*}(42);
+static const field core::String bar = "hello ${const core::String::fromEnvironment("baz", defaultValue: "world")}!";
+static const field core::bool baz = true && true && (false || true) && 42.{core::num::==}(21.{core::num::*}(4).{core::num::/}(2));
+static const field core::Symbol blaSymbol = #_x;
+static method main() → dynamic
+ ;
+static method _x() → void
+ ;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.expect
new file mode 100644
index 0000000..113d7a2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int foo = #C1;
+static const field core::String bar = #C6;
+static const field core::bool baz = #C7;
+static const field core::Symbol blaSymbol = #C8;
+static method main() → dynamic {
+ self::_x();
+ #C10;
+ core::print(#C11);
+}
+static method _x() → void {
+ core::print(#C1);
+ core::print(#C12);
+}
+
+constants {
+ #C1 = 1764
+ #C2 = "hello "
+ #C3 = "baz"
+ #C4 = "world"
+ #C5 = "!"
+ #C6 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+ #C7 = true
+ #C8 = #org-dartlang-testcase:///rudimentary_test_01.dart::_x
+ #C9 = "foo"
+ #C10 = eval const core::bool::fromEnvironment(#C9)
+ #C11 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+ #C12 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.transformed.expect
new file mode 100644
index 0000000..113d7a2
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.strong.transformed.expect
@@ -0,0 +1,32 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+
+static const field core::int foo = #C1;
+static const field core::String bar = #C6;
+static const field core::bool baz = #C7;
+static const field core::Symbol blaSymbol = #C8;
+static method main() → dynamic {
+ self::_x();
+ #C10;
+ core::print(#C11);
+}
+static method _x() → void {
+ core::print(#C1);
+ core::print(#C12);
+}
+
+constants {
+ #C1 = 1764
+ #C2 = "hello "
+ #C3 = "baz"
+ #C4 = "world"
+ #C5 = "!"
+ #C6 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+ #C7 = true
+ #C8 = #org-dartlang-testcase:///rudimentary_test_01.dart::_x
+ #C9 = "foo"
+ #C10 = eval const core::bool::fromEnvironment(#C9)
+ #C11 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+ #C12 = eval "${#C2}${const core::String::fromEnvironment(#C3, defaultValue: #C4)}${#C5}"
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline.expect
new file mode 100644
index 0000000..e88a140
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+const int foo = 42 * 42;
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const blaSymbol = #_x;
+main() {}
+void _x() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..8e6f0e5
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/rudimentary_test_01.dart.textual_outline_modelled.expect
@@ -0,0 +1,7 @@
+const String bar =
+ "hello" " " "${String.fromEnvironment("baz", defaultValue: "world")}" "!";
+const blaSymbol = #_x;
+const bool baz = true && true && (false || true) && (42 == 21 * 4 / 2);
+const int foo = 42 * 42;
+main() {}
+void _x() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart
new file mode 100644
index 0000000..43e4383
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart
@@ -0,0 +1,144 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import "various_lib.dart" deferred as lib;
+
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const bool? barFromEnvOrNull0 = const bool.fromEnvironment("bar") ? true : null;
+const bool barFromEnvOrNull =
+ const bool.fromEnvironment("bar", defaultValue: barFromEnvOrNull0!);
+const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+const bool nullAwareOnNull = barFromEnvOrNull ?? true;
+const bool andOnNull = barFromEnvOrNull && true;
+const bool andOnNull2 = true && barFromEnvOrNull;
+const bool orOnNull = barFromEnvOrNull || true;
+const bool orOnNull2 = barFromEnvOrNull || false;
+const bool orOnNull3 = true || barFromEnvOrNull;
+const bool orOnNull4 = false || barFromEnvOrNull;
+
+const fromDeferredLib = lib.x;
+
+class Foo<E> {
+ final bool saved;
+ final bool saved2;
+ const bool initialized =
+ const bool.fromEnvironment("foo", defaultValue: barFromEnv);
+ final E value;
+
+ const Foo(this.value,
+ {this.saved2: const bool.fromEnvironment("foo", defaultValue: barFromEnv),
+ bool x: const bool.fromEnvironment("foo", defaultValue: barFromEnv)})
+ : saved = x;
+}
+
+const x = const Foo<int>(42);
+
+const bool? y = true;
+const bool z = !(y!);
+
+const maybeInt = bool.fromEnvironment("foo") ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const maybeInt2 = z ? 42 : true;
+const bool isItInt2 = maybeInt2 is int ? true : false;
+const maybeInt3 = z ? 42 : null;
+const bool isItInt3 = maybeInt3 is int ? true : false;
+
+const dynamic listOfNull = [null];
+const bool isListOfNull = listOfNull is List<Null>;
+const dynamic listOfInt = [42];
+const bool isListOfInt = listOfInt is List<int>;
+const bool isList = listOfInt is List;
+const dynamic setOfInt = {42};
+const bool isSetOfInt = setOfInt is Set<int>;
+const dynamic mapOfInt = {42: 42};
+const bool isMapOfInt = mapOfInt is Map<int, int>;
+const dynamic listOfListOfInt = [
+ [42]
+];
+const bool isListOfListOfInt = listOfListOfInt is List<List<int>>;
+const dynamic setOfSetOfInt = {
+ {42}
+};
+const bool isSetOfSetOfInt = setOfSetOfInt is Set<Set<int>>;
+const dynamic mapOfMapOfInt1 = {
+ {42: 42}: 42
+};
+const dynamic mapOfMapOfInt2 = {
+ 42: {42: 42}
+};
+const bool isMapOfMapOfInt1 = mapOfMapOfInt1 is Map<Map<int, int>, int>;
+const bool isMapOfMapOfInt2 = mapOfMapOfInt2 is Map<int, Map<int, int>>;
+
+const Symbol symbolWithUnevaluatedParameter =
+ const Symbol(String.fromEnvironment("foo"));
+const Symbol symbolWithInvalidName = const Symbol("42");
+
+class A {
+ const A();
+
+ A operator -() => this;
+}
+
+class B implements A {
+ const B();
+
+ B operator -() => this;
+}
+
+class C implements A {
+ const C();
+
+ C operator -() => this;
+}
+
+class Class<T extends A> {
+ const Class(T t);
+ const Class.redirect(dynamic t) : this(t);
+ const Class.method(T t) : this(-t);
+}
+
+class Subclass<T extends A> extends Class<T> {
+ const Subclass(dynamic t) : super(t);
+}
+
+const c0 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(C());
+const c1 = bool.fromEnvironment("x") ? null : const Class<A>.method(A());
+const c2 = bool.fromEnvironment("x") ? null : const Subclass<B>(C());
+const c3 = bool.fromEnvironment("x") ? null : const Class<A>(A());
+const c4 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(B());
+const c5 = bool.fromEnvironment("x") ? null : const Subclass<A>(A());
+const c6 = bool.fromEnvironment("x") ? null : const Subclass<B>(B());
+
+typedef F = int Function(int, {int named});
+const f = F;
+
+class ConstClassWithF {
+ final F foo;
+ const ConstClassWithF(this.foo);
+}
+
+int procedure(int i, {int named}) => i;
+ConstClassWithF constClassWithF1 = const ConstClassWithF(procedure);
+const ConstClassWithF constClassWithF2 = const ConstClassWithF(procedure);
+
+const bool unevaluatedBool = bool.fromEnvironment("foo");
+const bool notUnevaluatedBool = !unevaluatedBool;
+const bool? unevaluatedBoolOrNull =
+ bool.fromEnvironment("bar") ? unevaluatedBool : null;
+const bool unevaluatedBoolNotNull = unevaluatedBoolOrNull!;
+
+main() {
+ print(c0);
+ print(c1);
+ print(c2);
+ print(c3);
+ print(c4);
+ print(c5);
+ print(c6);
+ print(x);
+ print(x.saved);
+ print(x.value);
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.outline.expect
new file mode 100644
index 0000000..46e5d2f
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.outline.expect
@@ -0,0 +1,157 @@
+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;
+// ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+import "various_lib.dart" as var;
+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;
+ final field self::Foo::E% value;
+ const constructor •(self::Foo::E% value, {core::bool saved2 = const core::bool::fromEnvironment("foo", defaultValue: self::barFromEnv), core::bool x = const core::bool::fromEnvironment("foo", defaultValue: self::barFromEnv)}) → 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
+ ;
+}
+class B extends core::Object implements self::A /*hasConstConstructor*/ {
+ const constructor •() → self::B
+ : super core::Object::•()
+ ;
+ operator unary-() → self::B
+ ;
+}
+class C extends core::Object implements self::A /*hasConstConstructor*/ {
+ const constructor •() → self::C
+ : super core::Object::•()
+ ;
+ operator unary-() → self::C
+ ;
+}
+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 = const core::bool::fromEnvironment("bar");
+static const field core::bool hasBarEnv = const core::bool::hasEnvironment("bar");
+static const field core::bool? barFromEnvOrNull0 = const core::bool::fromEnvironment("bar") ?{core::bool?} true : null;
+static const field core::bool barFromEnvOrNull = const core::bool::fromEnvironment("bar", defaultValue: self::barFromEnvOrNull0!);
+static const field core::bool notBarFromEnvOrNull = !self::barFromEnvOrNull;
+static const field core::bool conditionalOnNull = self::barFromEnvOrNull ?{core::bool} true : false;
+static const field core::bool nullAwareOnNull = let final core::bool #t2 = self::barFromEnvOrNull in #t2.{core::Object::==}(null) ?{core::bool} true : #t2;
+static const field core::bool andOnNull = self::barFromEnvOrNull && true;
+static const field core::bool andOnNull2 = true && self::barFromEnvOrNull;
+static const field core::bool orOnNull = self::barFromEnvOrNull || true;
+static const field core::bool orOnNull2 = self::barFromEnvOrNull || false;
+static const field core::bool orOnNull3 = true || self::barFromEnvOrNull;
+static const field core::bool orOnNull4 = false || self::barFromEnvOrNull;
+static const field core::int fromDeferredLib = let final dynamic #t3 = CheckLibraryIsLoaded(lib) in var::x;
+static const field self::Foo<core::int> x = const self::Foo::•<core::int>(42);
+static const field core::bool? y = true;
+static const field core::bool z = !self::y!;
+static const field core::Object maybeInt = const core::bool::fromEnvironment("foo") ?{core::Object} 42 : true;
+static const field core::bool isItInt = self::maybeInt is{ForNonNullableByDefault} core::int ?{core::bool} true : false;
+static const field core::Object maybeInt2 = self::z ?{core::Object} 42 : true;
+static const field core::bool isItInt2 = self::maybeInt2 is{ForNonNullableByDefault} core::int ?{core::bool} true : false;
+static const field core::int? maybeInt3 = self::z ?{core::int?} 42 : null;
+static const field core::bool isItInt3 = self::maybeInt3 is{ForNonNullableByDefault} core::int ?{core::bool} true : false;
+static const field dynamic listOfNull = const <core::Null?>[null];
+static const field core::bool isListOfNull = self::listOfNull is{ForNonNullableByDefault} core::List<core::Null?>;
+static const field dynamic listOfInt = const <core::int>[42];
+static const field core::bool isListOfInt = self::listOfInt is{ForNonNullableByDefault} core::List<core::int>;
+static const field core::bool isList = self::listOfInt is{ForNonNullableByDefault} core::List<dynamic>;
+static const field dynamic setOfInt = const <core::int>{42};
+static const field core::bool isSetOfInt = self::setOfInt is{ForNonNullableByDefault} core::Set<core::int>;
+static const field dynamic mapOfInt = const <core::int, core::int>{42: 42};
+static const field core::bool isMapOfInt = self::mapOfInt is{ForNonNullableByDefault} core::Map<core::int, core::int>;
+static const field dynamic listOfListOfInt = const <core::List<core::int>>[const <core::int>[42]];
+static const field core::bool isListOfListOfInt = self::listOfListOfInt is{ForNonNullableByDefault} core::List<core::List<core::int>>;
+static const field dynamic setOfSetOfInt = const <core::Set<core::int>>{const <core::int>{42}};
+static const field core::bool isSetOfSetOfInt = self::setOfSetOfInt is{ForNonNullableByDefault} core::Set<core::Set<core::int>>;
+static const field dynamic mapOfMapOfInt1 = const <core::Map<core::int, core::int>, core::int>{const <core::int, core::int>{42: 42}: 42};
+static const field dynamic mapOfMapOfInt2 = const <core::int, core::Map<core::int, core::int>>{42: const <core::int, core::int>{42: 42}};
+static const field core::bool isMapOfMapOfInt1 = self::mapOfMapOfInt1 is{ForNonNullableByDefault} core::Map<core::Map<core::int, core::int>, core::int>;
+static const field core::bool isMapOfMapOfInt2 = self::mapOfMapOfInt2 is{ForNonNullableByDefault} core::Map<core::int, core::Map<core::int, core::int>>;
+static const field core::Symbol symbolWithUnevaluatedParameter = const _in::Symbol::•(const core::String::fromEnvironment("foo"));
+static const field core::Symbol symbolWithInvalidName = const _in::Symbol::•("42");
+static const field self::Class<self::B>? c0 = const core::bool::fromEnvironment("x") ?{self::Class<self::B>?} null : const self::Class::redirect<self::B>(const self::C::•());
+static const field self::Class<self::A>? c1 = const core::bool::fromEnvironment("x") ?{self::Class<self::A>?} null : const self::Class::method<self::A>(const self::A::•());
+static const field self::Subclass<self::B>? c2 = const core::bool::fromEnvironment("x") ?{self::Subclass<self::B>?} null : const self::Subclass::•<self::B>(const self::C::•());
+static const field self::Class<self::A>? c3 = const core::bool::fromEnvironment("x") ?{self::Class<self::A>?} null : const self::Class::•<self::A>(const self::A::•());
+static const field self::Class<self::B>? c4 = const core::bool::fromEnvironment("x") ?{self::Class<self::B>?} null : const self::Class::redirect<self::B>(const self::B::•());
+static const field self::Subclass<self::A>? c5 = const core::bool::fromEnvironment("x") ?{self::Subclass<self::A>?} null : const self::Subclass::•<self::A>(const self::A::•());
+static const field self::Subclass<self::B>? c6 = const core::bool::fromEnvironment("x") ?{self::Subclass<self::B>?} null : const self::Subclass::•<self::B>(const self::B::•());
+static const field core::Type f = (core::int, {named: core::int}) → core::int;
+static field self::ConstClassWithF constClassWithF1;
+static const field self::ConstClassWithF constClassWithF2 = const self::ConstClassWithF::•(self::procedure);
+static const field core::bool unevaluatedBool = const core::bool::fromEnvironment("foo");
+static const field core::bool notUnevaluatedBool = !self::unevaluatedBool;
+static const field core::bool? unevaluatedBoolOrNull = const core::bool::fromEnvironment("bar") ?{core::bool?} self::unevaluatedBool : null;
+static const field core::bool unevaluatedBoolNotNull = self::unevaluatedBoolOrNull!;
+static method procedure(core::int i, {core::int named}) → core::int
+ ;
+static method main() → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as var;
+import "dart:core" as core;
+
+static const field core::int x = 42;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.expect
new file mode 100644
index 0000000..349600b
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.expect
@@ -0,0 +1,263 @@
+//
+// Problems in component:
+//
+// 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");
+// ^
+//
+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 =
+// ^
+//
+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}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.transformed.expect
new file mode 100644
index 0000000..349600b
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.strong.transformed.expect
@@ -0,0 +1,263 @@
+//
+// Problems in component:
+//
+// 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");
+// ^
+//
+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 =
+// ^
+//
+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}
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline.expect
new file mode 100644
index 0000000..602836a
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline.expect
@@ -0,0 +1,117 @@
+import "various_lib.dart" deferred as lib;
+
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const bool? barFromEnvOrNull0 = const bool.fromEnvironment("bar") ? true : null;
+const bool barFromEnvOrNull =
+ const bool.fromEnvironment("bar", defaultValue: barFromEnvOrNull0!);
+const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+const bool nullAwareOnNull = barFromEnvOrNull ?? true;
+const bool andOnNull = barFromEnvOrNull && true;
+const bool andOnNull2 = true && barFromEnvOrNull;
+const bool orOnNull = barFromEnvOrNull || true;
+const bool orOnNull2 = barFromEnvOrNull || false;
+const bool orOnNull3 = true || barFromEnvOrNull;
+const bool orOnNull4 = false || barFromEnvOrNull;
+const fromDeferredLib = lib.x;
+
+class Foo<E> {
+ final bool saved;
+ final bool saved2;
+ const bool initialized =
+ const bool.fromEnvironment("foo", defaultValue: barFromEnv);
+ final E value;
+ const Foo(this.value,
+ {this.saved2: const bool.fromEnvironment("foo", defaultValue: barFromEnv),
+ bool x: const bool.fromEnvironment("foo", defaultValue: barFromEnv)})
+ : saved = x;
+}
+
+const x = const Foo<int>(42);
+const bool? y = true;
+const bool z = !(y!);
+const maybeInt = bool.fromEnvironment("foo") ? 42 : true;
+const bool isItInt = maybeInt is int ? true : false;
+const maybeInt2 = z ? 42 : true;
+const bool isItInt2 = maybeInt2 is int ? true : false;
+const maybeInt3 = z ? 42 : null;
+const bool isItInt3 = maybeInt3 is int ? true : false;
+const dynamic listOfNull = [null];
+const bool isListOfNull = listOfNull is List<Null>;
+const dynamic listOfInt = [42];
+const bool isListOfInt = listOfInt is List<int>;
+const bool isList = listOfInt is List;
+const dynamic setOfInt = {42};
+const bool isSetOfInt = setOfInt is Set<int>;
+const dynamic mapOfInt = {42: 42};
+const bool isMapOfInt = mapOfInt is Map<int, int>;
+const dynamic listOfListOfInt = [
+ [42]
+];
+const bool isListOfListOfInt = listOfListOfInt is List<List<int>>;
+const dynamic setOfSetOfInt = {
+ {42}
+};
+const bool isSetOfSetOfInt = setOfSetOfInt is Set<Set<int>>;
+const dynamic mapOfMapOfInt1 = {
+ {42: 42}: 42
+};
+const dynamic mapOfMapOfInt2 = {
+ 42: {42: 42}
+};
+const bool isMapOfMapOfInt1 = mapOfMapOfInt1 is Map<Map<int, int>, int>;
+const bool isMapOfMapOfInt2 = mapOfMapOfInt2 is Map<int, Map<int, int>>;
+const Symbol symbolWithUnevaluatedParameter =
+ const Symbol(String.fromEnvironment("foo"));
+const Symbol symbolWithInvalidName = const Symbol("42");
+
+class A {
+ const A();
+ A operator -() => this;
+}
+
+class B implements A {
+ const B();
+ B operator -() => this;
+}
+
+class C implements A {
+ const C();
+ C operator -() => this;
+}
+
+class Class<T extends A> {
+ const Class(T t);
+ const Class.redirect(dynamic t) : this(t);
+ const Class.method(T t) : this(-t);
+}
+
+class Subclass<T extends A> extends Class<T> {
+ const Subclass(dynamic t) : super(t);
+}
+
+const c0 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(C());
+const c1 = bool.fromEnvironment("x") ? null : const Class<A>.method(A());
+const c2 = bool.fromEnvironment("x") ? null : const Subclass<B>(C());
+const c3 = bool.fromEnvironment("x") ? null : const Class<A>(A());
+const c4 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(B());
+const c5 = bool.fromEnvironment("x") ? null : const Subclass<A>(A());
+const c6 = bool.fromEnvironment("x") ? null : const Subclass<B>(B());
+typedef F = int Function(int, {int named});
+const f = F;
+
+class ConstClassWithF {
+ final F foo;
+ const ConstClassWithF(this.foo);
+}
+
+int procedure(int i, {int named}) => i;
+ConstClassWithF constClassWithF1 = const ConstClassWithF(procedure);
+const ConstClassWithF constClassWithF2 = const ConstClassWithF(procedure);
+const bool unevaluatedBool = bool.fromEnvironment("foo");
+const bool notUnevaluatedBool = !unevaluatedBool;
+const bool? unevaluatedBoolOrNull =
+ bool.fromEnvironment("bar") ? unevaluatedBool : null;
+const bool unevaluatedBoolNotNull = unevaluatedBoolOrNull!;
+main() {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..80ce452
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various.dart.textual_outline_modelled.expect
@@ -0,0 +1,115 @@
+import "various_lib.dart" deferred as lib;
+
+ConstClassWithF constClassWithF1 = const ConstClassWithF(procedure);
+
+class A {
+ A operator -() => this;
+ const A();
+}
+
+class B implements A {
+ B operator -() => this;
+ const B();
+}
+
+class C implements A {
+ C operator -() => this;
+ const C();
+}
+
+class Class<T extends A> {
+ const Class(T t);
+ const Class.method(T t) : this(-t);
+ const Class.redirect(dynamic t) : this(t);
+}
+
+class ConstClassWithF {
+ const ConstClassWithF(this.foo);
+ final F foo;
+}
+
+class Foo<E> {
+ const Foo(this.value,
+ {this.saved2: const bool.fromEnvironment("foo", defaultValue: barFromEnv),
+ bool x: const bool.fromEnvironment("foo", defaultValue: barFromEnv)})
+ : saved = x;
+ const bool initialized =
+ const bool.fromEnvironment("foo", defaultValue: barFromEnv);
+ final E value;
+ final bool saved;
+ final bool saved2;
+}
+
+class Subclass<T extends A> extends Class<T> {
+ const Subclass(dynamic t) : super(t);
+}
+
+const ConstClassWithF constClassWithF2 = const ConstClassWithF(procedure);
+const Symbol symbolWithInvalidName = const Symbol("42");
+const Symbol symbolWithUnevaluatedParameter =
+ const Symbol(String.fromEnvironment("foo"));
+const bool? barFromEnvOrNull0 = const bool.fromEnvironment("bar") ? true : null;
+const bool? unevaluatedBoolOrNull =
+ bool.fromEnvironment("bar") ? unevaluatedBool : null;
+const bool? y = true;
+const bool andOnNull = barFromEnvOrNull && true;
+const bool andOnNull2 = true && barFromEnvOrNull;
+const bool barFromEnv = const bool.fromEnvironment("bar");
+const bool barFromEnvOrNull =
+ const bool.fromEnvironment("bar", defaultValue: barFromEnvOrNull0!);
+const bool conditionalOnNull = barFromEnvOrNull ? true : false;
+const bool hasBarEnv = const bool.hasEnvironment("bar");
+const bool isItInt = maybeInt is int ? true : false;
+const bool isItInt2 = maybeInt2 is int ? true : false;
+const bool isItInt3 = maybeInt3 is int ? true : false;
+const bool isList = listOfInt is List;
+const bool isListOfInt = listOfInt is List<int>;
+const bool isListOfListOfInt = listOfListOfInt is List<List<int>>;
+const bool isListOfNull = listOfNull is List<Null>;
+const bool isMapOfInt = mapOfInt is Map<int, int>;
+const bool isMapOfMapOfInt1 = mapOfMapOfInt1 is Map<Map<int, int>, int>;
+const bool isMapOfMapOfInt2 = mapOfMapOfInt2 is Map<int, Map<int, int>>;
+const bool isSetOfInt = setOfInt is Set<int>;
+const bool isSetOfSetOfInt = setOfSetOfInt is Set<Set<int>>;
+const bool notBarFromEnvOrNull = !barFromEnvOrNull;
+const bool notUnevaluatedBool = !unevaluatedBool;
+const bool nullAwareOnNull = barFromEnvOrNull ?? true;
+const bool orOnNull = barFromEnvOrNull || true;
+const bool orOnNull2 = barFromEnvOrNull || false;
+const bool orOnNull3 = true || barFromEnvOrNull;
+const bool orOnNull4 = false || barFromEnvOrNull;
+const bool unevaluatedBool = bool.fromEnvironment("foo");
+const bool unevaluatedBoolNotNull = unevaluatedBoolOrNull!;
+const bool z = !(y!);
+const c0 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(C());
+const c1 = bool.fromEnvironment("x") ? null : const Class<A>.method(A());
+const c2 = bool.fromEnvironment("x") ? null : const Subclass<B>(C());
+const c3 = bool.fromEnvironment("x") ? null : const Class<A>(A());
+const c4 = bool.fromEnvironment("x") ? null : const Class<B>.redirect(B());
+const c5 = bool.fromEnvironment("x") ? null : const Subclass<A>(A());
+const c6 = bool.fromEnvironment("x") ? null : const Subclass<B>(B());
+const dynamic listOfInt = [42];
+const dynamic listOfListOfInt = [
+ [42]
+];
+const dynamic listOfNull = [null];
+const dynamic mapOfInt = {42: 42};
+const dynamic mapOfMapOfInt1 = {
+ {42: 42}: 42
+};
+const dynamic mapOfMapOfInt2 = {
+ 42: {42: 42}
+};
+const dynamic setOfInt = {42};
+const dynamic setOfSetOfInt = {
+ {42}
+};
+const f = F;
+const fromDeferredLib = lib.x;
+const maybeInt = bool.fromEnvironment("foo") ? 42 : true;
+const maybeInt2 = z ? 42 : true;
+const maybeInt3 = z ? 42 : null;
+const x = const Foo<int>(42);
+int procedure(int i, {int named}) => i;
+main() {}
+typedef F = int Function(int, {int named});
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart
new file mode 100644
index 0000000..f8da5a4
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart
@@ -0,0 +1,88 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'various_2_lib.dart' as lib;
+
+typedef F1<T> = T Function(T);
+typedef F2 = T Function<T>(T);
+
+const objectTypeLiteral = Object;
+const int Function(int) partialInstantiation = lib.id1;
+const instance = const lib.Class<int>(0);
+const instance2 = const lib.Class<dynamic>([42]);
+
+const functionTypeLiteral = F1;
+const genericFunctionTypeLiteral = F2;
+const listLiteral = <int>[0];
+const listLiteral2 = <dynamic>[
+ <int>[42]
+];
+const setLiteral = <int>{0};
+const setLiteral2 = <dynamic>{
+ <int>[42]
+};
+const mapLiteral = <int, String>{0: 'foo'};
+const mapLiteral2 = <dynamic, dynamic>{
+ <int>[42]: 'foo',
+ null: <int>[42]
+};
+const listConcatenation = <int>[...listLiteral];
+const setConcatenation = <int>{...setLiteral};
+const mapConcatenation = <int, String>{...mapLiteral};
+
+const objectTypeLiteralIdentical =
+ identical(objectTypeLiteral, lib.objectTypeLiteral);
+const partialInstantiationIdentical =
+ identical(partialInstantiation, lib.partialInstantiation);
+const instanceIdentical = identical(instance, lib.instance);
+const instance2Identical = identical(instance2, lib.instance2);
+const functionTypeLiteralIdentical =
+ identical(functionTypeLiteral, lib.functionTypeLiteral);
+const genericFunctionTypeLiteralIdentical =
+ identical(genericFunctionTypeLiteral, lib.genericFunctionTypeLiteral);
+const listLiteralIdentical = identical(listLiteral, lib.listLiteral);
+const listLiteral2Identical = identical(listLiteral2, lib.listLiteral2);
+const setLiteralIdentical = identical(setLiteral, lib.setLiteral);
+const setLiteral2Identical = identical(setLiteral2, lib.setLiteral2);
+const mapLiteralIdentical = identical(mapLiteral, lib.mapLiteral);
+const mapLiteral2Identical = identical(mapLiteral2, lib.mapLiteral2);
+const listConcatenationIdentical =
+ identical(listConcatenation, lib.listConcatenation);
+const setConcatenationIdentical =
+ identical(setConcatenation, lib.setConcatenation);
+const mapConcatenationIdentical =
+ identical(mapConcatenation, lib.mapConcatenation);
+
+main() {
+ test(objectTypeLiteral, lib.objectTypeLiteral);
+ test(partialInstantiation, lib.partialInstantiation);
+ test(instance, lib.instance);
+ test(functionTypeLiteral, lib.functionTypeLiteral);
+ test(genericFunctionTypeLiteral, lib.genericFunctionTypeLiteral);
+ test(listLiteral, lib.listLiteral);
+ test(setLiteral, lib.setLiteral);
+ test(mapLiteral, lib.mapLiteral);
+ test(listConcatenation, lib.listConcatenation);
+ test(setConcatenation, lib.setConcatenation);
+ test(mapConcatenation, lib.mapConcatenation);
+
+ test(true, objectTypeLiteralIdentical);
+ test(true, partialInstantiationIdentical);
+ test(true, instanceIdentical);
+ test(true, functionTypeLiteralIdentical);
+ test(true, genericFunctionTypeLiteralIdentical);
+ test(true, listLiteralIdentical);
+ test(true, setLiteralIdentical);
+ test(true, mapLiteralIdentical);
+ test(true, listConcatenationIdentical);
+ test(true, setConcatenationIdentical);
+ test(true, mapConcatenationIdentical);
+}
+
+test(expected, actual) {
+ print('test($expected, $actual)');
+ if (!identical(expected, actual)) {
+ throw 'Expected $expected, actual $actual';
+ }
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.outline.expect
new file mode 100644
index 0000000..ed664fb
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.outline.expect
@@ -0,0 +1,76 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "various_2_lib.dart" as var;
+
+import "org-dartlang-testcase:///various_2_lib.dart" as lib;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+static const field core::Type objectTypeLiteral = core::Object;
+static const field (core::int) → core::int partialInstantiation = var::id1<core::int>;
+static const field var::Class<core::int> instance = const var::Class::•<core::int>(0);
+static const field var::Class<dynamic> instance2 = const var::Class::•<dynamic>(const <core::int>[42]);
+static const field core::Type functionTypeLiteral = (dynamic) → dynamic;
+static const field core::Type genericFunctionTypeLiteral = <T extends core::Object? = dynamic>(T%) → T%;
+static const field core::List<core::int> listLiteral = const <core::int>[0];
+static const field core::List<dynamic> listLiteral2 = const <dynamic>[const <core::int>[42]];
+static const field core::Set<core::int> setLiteral = const <core::int>{0};
+static const field core::Set<dynamic> setLiteral2 = const <dynamic>{const <core::int>[42]};
+static const field core::Map<core::int, core::String> mapLiteral = const <core::int, core::String>{0: "foo"};
+static const field core::Map<dynamic, dynamic> mapLiteral2 = const <dynamic, dynamic>{const <core::int>[42]: "foo", null: const <core::int>[42]};
+static const field core::List<core::int> listConcatenation = self::listLiteral;
+static const field core::Set<core::int> setConcatenation = self::setLiteral;
+static const field core::Map<core::int, core::String> mapConcatenation = self::mapLiteral;
+static const field core::bool objectTypeLiteralIdentical = core::identical(self::objectTypeLiteral, var::objectTypeLiteral);
+static const field core::bool partialInstantiationIdentical = core::identical(self::partialInstantiation, var::partialInstantiation);
+static const field core::bool instanceIdentical = core::identical(self::instance, var::instance);
+static const field core::bool instance2Identical = core::identical(self::instance2, var::instance2);
+static const field core::bool functionTypeLiteralIdentical = core::identical(self::functionTypeLiteral, var::functionTypeLiteral);
+static const field core::bool genericFunctionTypeLiteralIdentical = core::identical(self::genericFunctionTypeLiteral, var::genericFunctionTypeLiteral);
+static const field core::bool listLiteralIdentical = core::identical(self::listLiteral, var::listLiteral);
+static const field core::bool listLiteral2Identical = core::identical(self::listLiteral2, var::listLiteral2);
+static const field core::bool setLiteralIdentical = core::identical(self::setLiteral, var::setLiteral);
+static const field core::bool setLiteral2Identical = core::identical(self::setLiteral2, var::setLiteral2);
+static const field core::bool mapLiteralIdentical = core::identical(self::mapLiteral, var::mapLiteral);
+static const field core::bool mapLiteral2Identical = core::identical(self::mapLiteral2, var::mapLiteral2);
+static const field core::bool listConcatenationIdentical = core::identical(self::listConcatenation, var::listConcatenation);
+static const field core::bool setConcatenationIdentical = core::identical(self::setConcatenation, var::setConcatenation);
+static const field core::bool mapConcatenationIdentical = core::identical(self::mapConcatenation, var::mapConcatenation);
+static method main() → dynamic
+ ;
+static method test(dynamic expected, dynamic actual) → dynamic
+ ;
+
+library /*isNonNullableByDefault*/;
+import self as var;
+import "dart:core" as core;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field var::Class::T% field;
+ const constructor •(var::Class::T% field) → var::Class<var::Class::T%>
+ : var::Class::field = field, super core::Object::•()
+ ;
+}
+static const field core::Type objectTypeLiteral = core::Object;
+static const field (core::Object?, core::Object?) → core::bool c2 = core::identical;
+static const field (core::int) → core::int partialInstantiation = const core::bool::fromEnvironment("foo") ?{(core::int) → core::int} var::id1<core::int> : var::id2<core::int>;
+static const field var::Class<core::int> instance = const var::Class::•<core::int>(0);
+static const field var::Class<dynamic> instance2 = const var::Class::•<dynamic>(const <core::int>[42]);
+static const field core::Type functionTypeLiteral = (dynamic) → dynamic;
+static const field core::Type genericFunctionTypeLiteral = <T extends core::Object? = dynamic>(T%) → T%;
+static const field core::List<core::int> listLiteral = const <core::int>[0];
+static const field core::List<dynamic> listLiteral2 = const <dynamic>[const <core::int>[42]];
+static const field core::Set<core::int> setLiteral = const <core::int>{0};
+static const field core::Set<dynamic> setLiteral2 = const <dynamic>{const <core::int>[42]};
+static const field core::Map<core::int, core::String> mapLiteral = const <core::int, core::String>{0: "foo"};
+static const field core::Map<dynamic, dynamic> mapLiteral2 = const <dynamic, dynamic>{const <core::int>[42]: "foo", null: const <core::int>[42]};
+static const field core::List<core::int> listConcatenation = var::listLiteral;
+static const field core::Set<core::int> setConcatenation = var::setLiteral;
+static const field core::Map<core::int, core::String> mapConcatenation = var::mapLiteral;
+static method id1<T extends core::Object? = dynamic>(var::id1::T% t) → var::id1::T%
+ ;
+static method id2<T extends core::Object? = dynamic>(var::id2::T% t) → var::id2::T%
+ ;
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.expect
new file mode 100644
index 0000000..95db2f1
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.expect
@@ -0,0 +1,130 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "various_2_lib.dart" as var;
+
+import "org-dartlang-testcase:///various_2_lib.dart" as lib;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+static const field core::Type objectTypeLiteral = #C1;
+static const field (core::int) → core::int partialInstantiation = #C3;
+static const field var::Class<core::int> instance = #C5;
+static const field var::Class<dynamic> instance2 = #C8;
+static const field core::Type functionTypeLiteral = #C9;
+static const field core::Type genericFunctionTypeLiteral = #C10;
+static const field core::List<core::int> listLiteral = #C11;
+static const field core::List<dynamic> listLiteral2 = #C12;
+static const field core::Set<core::int> setLiteral = #C13;
+static const field core::Set<dynamic> setLiteral2 = #C14;
+static const field core::Map<core::int, core::String> mapLiteral = #C16;
+static const field core::Map<dynamic, dynamic> mapLiteral2 = #C18;
+static const field core::List<core::int> listConcatenation = #C11;
+static const field core::Set<core::int> setConcatenation = #C13;
+static const field core::Map<core::int, core::String> mapConcatenation = #C16;
+static const field core::bool objectTypeLiteralIdentical = #C19;
+static const field core::bool partialInstantiationIdentical = #C21;
+static const field core::bool instanceIdentical = #C19;
+static const field core::bool instance2Identical = #C19;
+static const field core::bool functionTypeLiteralIdentical = #C19;
+static const field core::bool genericFunctionTypeLiteralIdentical = #C19;
+static const field core::bool listLiteralIdentical = #C19;
+static const field core::bool listLiteral2Identical = #C19;
+static const field core::bool setLiteralIdentical = #C19;
+static const field core::bool setLiteral2Identical = #C19;
+static const field core::bool mapLiteralIdentical = #C19;
+static const field core::bool mapLiteral2Identical = #C19;
+static const field core::bool listConcatenationIdentical = #C19;
+static const field core::bool setConcatenationIdentical = #C19;
+static const field core::bool mapConcatenationIdentical = #C19;
+static method main() → dynamic {
+ self::test(#C1, #C1);
+ self::test(#C3, #C22);
+ self::test(#C5, #C5);
+ self::test(#C9, #C9);
+ self::test(#C10, #C10);
+ self::test(#C11, #C11);
+ self::test(#C13, #C13);
+ self::test(#C16, #C16);
+ self::test(#C11, #C11);
+ self::test(#C13, #C13);
+ self::test(#C16, #C16);
+ self::test(true, #C19);
+ self::test(true, #C23);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+}
+static method test(dynamic expected, dynamic actual) → dynamic {
+ core::print("test(${expected}, ${actual})");
+ if(!core::identical(expected, actual)) {
+ throw "Expected ${expected}, actual ${actual}";
+ }
+}
+
+library /*isNonNullableByDefault*/;
+import self as var;
+import "dart:core" as core;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field var::Class::T% field;
+ const constructor •(var::Class::T% field) → var::Class<var::Class::T%>
+ : var::Class::field = field, super core::Object::•()
+ ;
+}
+static const field core::Type objectTypeLiteral = #C1;
+static const field (core::Object?, core::Object?) → core::bool c2 = #C24;
+static const field (core::int) → core::int partialInstantiation = #C25;
+static const field var::Class<core::int> instance = #C5;
+static const field var::Class<dynamic> instance2 = #C8;
+static const field core::Type functionTypeLiteral = #C9;
+static const field core::Type genericFunctionTypeLiteral = #C10;
+static const field core::List<core::int> listLiteral = #C11;
+static const field core::List<dynamic> listLiteral2 = #C12;
+static const field core::Set<core::int> setLiteral = #C13;
+static const field core::Set<dynamic> setLiteral2 = #C14;
+static const field core::Map<core::int, core::String> mapLiteral = #C16;
+static const field core::Map<dynamic, dynamic> mapLiteral2 = #C18;
+static const field core::List<core::int> listConcatenation = #C11;
+static const field core::Set<core::int> setConcatenation = #C13;
+static const field core::Map<core::int, core::String> mapConcatenation = #C16;
+static method id1<T extends core::Object? = dynamic>(var::id1::T% t) → var::id1::T%
+ return t;
+static method id2<T extends core::Object? = dynamic>(var::id2::T% t) → var::id2::T%
+ return t;
+
+constants {
+ #C1 = TypeLiteralConstant(core::Object)
+ #C2 = tearoff var::id1
+ #C3 = partial-instantiation var::id1 <core::int>
+ #C4 = 0
+ #C5 = var::Class<core::int> {field:#C4}
+ #C6 = 42
+ #C7 = <core::int>[#C6]
+ #C8 = var::Class<dynamic> {field:#C7}
+ #C9 = TypeLiteralConstant((dynamic) → dynamic)
+ #C10 = TypeLiteralConstant(<T extends core::Object? = dynamic>(T%) → T%)
+ #C11 = <core::int>[#C4]
+ #C12 = <dynamic>[#C7]
+ #C13 = <core::int>{#C4}
+ #C14 = <dynamic>{#C7}
+ #C15 = "foo"
+ #C16 = <core::int, core::String>{#C4:#C15)
+ #C17 = null
+ #C18 = <dynamic, dynamic>{#C7:#C15, #C17:#C7)
+ #C19 = true
+ #C20 = tearoff var::id2
+ #C21 = eval const core::identical(#C3, const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>)
+ #C22 = eval const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>
+ #C23 = eval const core::identical(#C3, const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>)
+ #C24 = tearoff core::identical
+ #C25 = eval const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.transformed.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.transformed.expect
new file mode 100644
index 0000000..95db2f1
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.strong.transformed.expect
@@ -0,0 +1,130 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+import "dart:core" as core;
+import "various_2_lib.dart" as var;
+
+import "org-dartlang-testcase:///various_2_lib.dart" as lib;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+static const field core::Type objectTypeLiteral = #C1;
+static const field (core::int) → core::int partialInstantiation = #C3;
+static const field var::Class<core::int> instance = #C5;
+static const field var::Class<dynamic> instance2 = #C8;
+static const field core::Type functionTypeLiteral = #C9;
+static const field core::Type genericFunctionTypeLiteral = #C10;
+static const field core::List<core::int> listLiteral = #C11;
+static const field core::List<dynamic> listLiteral2 = #C12;
+static const field core::Set<core::int> setLiteral = #C13;
+static const field core::Set<dynamic> setLiteral2 = #C14;
+static const field core::Map<core::int, core::String> mapLiteral = #C16;
+static const field core::Map<dynamic, dynamic> mapLiteral2 = #C18;
+static const field core::List<core::int> listConcatenation = #C11;
+static const field core::Set<core::int> setConcatenation = #C13;
+static const field core::Map<core::int, core::String> mapConcatenation = #C16;
+static const field core::bool objectTypeLiteralIdentical = #C19;
+static const field core::bool partialInstantiationIdentical = #C21;
+static const field core::bool instanceIdentical = #C19;
+static const field core::bool instance2Identical = #C19;
+static const field core::bool functionTypeLiteralIdentical = #C19;
+static const field core::bool genericFunctionTypeLiteralIdentical = #C19;
+static const field core::bool listLiteralIdentical = #C19;
+static const field core::bool listLiteral2Identical = #C19;
+static const field core::bool setLiteralIdentical = #C19;
+static const field core::bool setLiteral2Identical = #C19;
+static const field core::bool mapLiteralIdentical = #C19;
+static const field core::bool mapLiteral2Identical = #C19;
+static const field core::bool listConcatenationIdentical = #C19;
+static const field core::bool setConcatenationIdentical = #C19;
+static const field core::bool mapConcatenationIdentical = #C19;
+static method main() → dynamic {
+ self::test(#C1, #C1);
+ self::test(#C3, #C22);
+ self::test(#C5, #C5);
+ self::test(#C9, #C9);
+ self::test(#C10, #C10);
+ self::test(#C11, #C11);
+ self::test(#C13, #C13);
+ self::test(#C16, #C16);
+ self::test(#C11, #C11);
+ self::test(#C13, #C13);
+ self::test(#C16, #C16);
+ self::test(true, #C19);
+ self::test(true, #C23);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+ self::test(true, #C19);
+}
+static method test(dynamic expected, dynamic actual) → dynamic {
+ core::print("test(${expected}, ${actual})");
+ if(!core::identical(expected, actual)) {
+ throw "Expected ${expected}, actual ${actual}";
+ }
+}
+
+library /*isNonNullableByDefault*/;
+import self as var;
+import "dart:core" as core;
+
+typedef F1<invariant T extends core::Object? = dynamic> = (T%) → T%;
+typedef F2 = <T extends core::Object? = dynamic>(T%) → T%;
+class Class<T extends core::Object? = dynamic> extends core::Object /*hasConstConstructor*/ {
+ final field var::Class::T% field;
+ const constructor •(var::Class::T% field) → var::Class<var::Class::T%>
+ : var::Class::field = field, super core::Object::•()
+ ;
+}
+static const field core::Type objectTypeLiteral = #C1;
+static const field (core::Object?, core::Object?) → core::bool c2 = #C24;
+static const field (core::int) → core::int partialInstantiation = #C25;
+static const field var::Class<core::int> instance = #C5;
+static const field var::Class<dynamic> instance2 = #C8;
+static const field core::Type functionTypeLiteral = #C9;
+static const field core::Type genericFunctionTypeLiteral = #C10;
+static const field core::List<core::int> listLiteral = #C11;
+static const field core::List<dynamic> listLiteral2 = #C12;
+static const field core::Set<core::int> setLiteral = #C13;
+static const field core::Set<dynamic> setLiteral2 = #C14;
+static const field core::Map<core::int, core::String> mapLiteral = #C16;
+static const field core::Map<dynamic, dynamic> mapLiteral2 = #C18;
+static const field core::List<core::int> listConcatenation = #C11;
+static const field core::Set<core::int> setConcatenation = #C13;
+static const field core::Map<core::int, core::String> mapConcatenation = #C16;
+static method id1<T extends core::Object? = dynamic>(var::id1::T% t) → var::id1::T%
+ return t;
+static method id2<T extends core::Object? = dynamic>(var::id2::T% t) → var::id2::T%
+ return t;
+
+constants {
+ #C1 = TypeLiteralConstant(core::Object)
+ #C2 = tearoff var::id1
+ #C3 = partial-instantiation var::id1 <core::int>
+ #C4 = 0
+ #C5 = var::Class<core::int> {field:#C4}
+ #C6 = 42
+ #C7 = <core::int>[#C6]
+ #C8 = var::Class<dynamic> {field:#C7}
+ #C9 = TypeLiteralConstant((dynamic) → dynamic)
+ #C10 = TypeLiteralConstant(<T extends core::Object? = dynamic>(T%) → T%)
+ #C11 = <core::int>[#C4]
+ #C12 = <dynamic>[#C7]
+ #C13 = <core::int>{#C4}
+ #C14 = <dynamic>{#C7}
+ #C15 = "foo"
+ #C16 = <core::int, core::String>{#C4:#C15)
+ #C17 = null
+ #C18 = <dynamic, dynamic>{#C7:#C15, #C17:#C7)
+ #C19 = true
+ #C20 = tearoff var::id2
+ #C21 = eval const core::identical(#C3, const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>)
+ #C22 = eval const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>
+ #C23 = eval const core::identical(#C3, const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>)
+ #C24 = tearoff core::identical
+ #C25 = eval const core::bool::fromEnvironment(#C15) ?{(core::int) → core::int} #C2<core::int> : #C20<core::int>
+}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline.expect
new file mode 100644
index 0000000..ba7ed46
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline.expect
@@ -0,0 +1,50 @@
+import 'various_2_lib.dart' as lib;
+
+typedef F1<T> = T Function(T);
+typedef F2 = T Function<T>(T);
+const objectTypeLiteral = Object;
+const int Function(int) partialInstantiation = lib.id1;
+const instance = const lib.Class<int>(0);
+const instance2 = const lib.Class<dynamic>([42]);
+const functionTypeLiteral = F1;
+const genericFunctionTypeLiteral = F2;
+const listLiteral = <int>[0];
+const listLiteral2 = <dynamic>[
+ <int>[42]
+];
+const setLiteral = <int>{0};
+const setLiteral2 = <dynamic>{
+ <int>[42]
+};
+const mapLiteral = <int, String>{0: 'foo'};
+const mapLiteral2 = <dynamic, dynamic>{
+ <int>[42]: 'foo',
+ null: <int>[42]
+};
+const listConcatenation = <int>[...listLiteral];
+const setConcatenation = <int>{...setLiteral};
+const mapConcatenation = <int, String>{...mapLiteral};
+const objectTypeLiteralIdentical =
+ identical(objectTypeLiteral, lib.objectTypeLiteral);
+const partialInstantiationIdentical =
+ identical(partialInstantiation, lib.partialInstantiation);
+const instanceIdentical = identical(instance, lib.instance);
+const instance2Identical = identical(instance2, lib.instance2);
+const functionTypeLiteralIdentical =
+ identical(functionTypeLiteral, lib.functionTypeLiteral);
+const genericFunctionTypeLiteralIdentical =
+ identical(genericFunctionTypeLiteral, lib.genericFunctionTypeLiteral);
+const listLiteralIdentical = identical(listLiteral, lib.listLiteral);
+const listLiteral2Identical = identical(listLiteral2, lib.listLiteral2);
+const setLiteralIdentical = identical(setLiteral, lib.setLiteral);
+const setLiteral2Identical = identical(setLiteral2, lib.setLiteral2);
+const mapLiteralIdentical = identical(mapLiteral, lib.mapLiteral);
+const mapLiteral2Identical = identical(mapLiteral2, lib.mapLiteral2);
+const listConcatenationIdentical =
+ identical(listConcatenation, lib.listConcatenation);
+const setConcatenationIdentical =
+ identical(setConcatenation, lib.setConcatenation);
+const mapConcatenationIdentical =
+ identical(mapConcatenation, lib.mapConcatenation);
+main() {}
+test(expected, actual) {}
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..a390688
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2.dart.textual_outline_modelled.expect
@@ -0,0 +1,50 @@
+import 'various_2_lib.dart' as lib;
+
+const functionTypeLiteral = F1;
+const functionTypeLiteralIdentical =
+ identical(functionTypeLiteral, lib.functionTypeLiteral);
+const genericFunctionTypeLiteral = F2;
+const genericFunctionTypeLiteralIdentical =
+ identical(genericFunctionTypeLiteral, lib.genericFunctionTypeLiteral);
+const instance = const lib.Class<int>(0);
+const instance2 = const lib.Class<dynamic>([42]);
+const instance2Identical = identical(instance2, lib.instance2);
+const instanceIdentical = identical(instance, lib.instance);
+const int Function(int) partialInstantiation = lib.id1;
+const listConcatenation = <int>[...listLiteral];
+const listConcatenationIdentical =
+ identical(listConcatenation, lib.listConcatenation);
+const listLiteral = <int>[0];
+const listLiteral2 = <dynamic>[
+ <int>[42]
+];
+const listLiteral2Identical = identical(listLiteral2, lib.listLiteral2);
+const listLiteralIdentical = identical(listLiteral, lib.listLiteral);
+const mapConcatenation = <int, String>{...mapLiteral};
+const mapConcatenationIdentical =
+ identical(mapConcatenation, lib.mapConcatenation);
+const mapLiteral = <int, String>{0: 'foo'};
+const mapLiteral2 = <dynamic, dynamic>{
+ <int>[42]: 'foo',
+ null: <int>[42]
+};
+const mapLiteral2Identical = identical(mapLiteral2, lib.mapLiteral2);
+const mapLiteralIdentical = identical(mapLiteral, lib.mapLiteral);
+const objectTypeLiteral = Object;
+const objectTypeLiteralIdentical =
+ identical(objectTypeLiteral, lib.objectTypeLiteral);
+const partialInstantiationIdentical =
+ identical(partialInstantiation, lib.partialInstantiation);
+const setConcatenation = <int>{...setLiteral};
+const setConcatenationIdentical =
+ identical(setConcatenation, lib.setConcatenation);
+const setLiteral = <int>{0};
+const setLiteral2 = <dynamic>{
+ <int>[42]
+};
+const setLiteral2Identical = identical(setLiteral2, lib.setLiteral2);
+const setLiteralIdentical = identical(setLiteral, lib.setLiteral);
+main() {}
+test(expected, actual) {}
+typedef F1<T> = T Function(T);
+typedef F2 = T Function<T>(T);
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2_lib.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2_lib.dart
new file mode 100644
index 0000000..7a06e11
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_2_lib.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+class Class<T> {
+ final T field;
+
+ const Class(this.field);
+}
+
+T id1<T>(T t) => t;
+T id2<T>(T t) => t;
+
+typedef F1<T> = T Function(T);
+typedef F2 = T Function<T>(T);
+
+const objectTypeLiteral = Object;
+const c2 = identical;
+const int Function(int) partialInstantiation =
+ const bool.fromEnvironment("foo") ? id1 : id2;
+const instance = const Class<int>(0);
+const instance2 = const Class<dynamic>([42]);
+const functionTypeLiteral = F1;
+const genericFunctionTypeLiteral = F2;
+const listLiteral = <int>[0];
+const listLiteral2 = <dynamic>[
+ <int>[42]
+];
+const setLiteral = <int>{0};
+const setLiteral2 = <dynamic>{
+ <int>[42]
+};
+const mapLiteral = <int, String>{0: 'foo'};
+const mapLiteral2 = <dynamic, dynamic>{
+ <int>[42]: 'foo',
+ null: <int>[42]
+};
+const listConcatenation = <int>[...listLiteral];
+const setConcatenation = <int>{...setLiteral};
+const mapConcatenation = <int, String>{...mapLiteral};
diff --git a/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_lib.dart b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_lib.dart
new file mode 100644
index 0000000..06d2cb3
--- /dev/null
+++ b/pkg/front_end/testcases/general/constants/with_unevaluated_agnostic/various_lib.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+const x = 42;
diff --git a/pkg/front_end/testcases/outline.status b/pkg/front_end/testcases/outline.status
index 3c00bd1..82835d3 100644
--- a/pkg/front_end/testcases/outline.status
+++ b/pkg/front_end/testcases/outline.status
@@ -14,6 +14,7 @@
general_nnbd_opt_out/override_setter_with_field: TypeCheckError
general/abstract_members: TypeCheckError
general/bug30695: TypeCheckError
+general/constants/const_collections: TypeCheckError
general/covariant_field: TypeCheckError
general/infer_field_from_multiple: TypeCheckError
general/invalid_operator: TypeCheckError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index 07eb30c..5515dcd 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -24,6 +24,10 @@
general/callable_type_variable: TypeCheckError
general/candidate_found: TypeCheckError
general/cascade: RuntimeError
+general/constants/with_unevaluated_agnostic/const_asserts: TextSerializationFailure
+general/constants/with_unevaluated_agnostic/const_collections: TextSerializationFailure
+general/constants/with_unevaluated_agnostic/various: TextSerializationFailure
+general/constants/with_unevaluated_agnostic/various_2: TextSerializationFailure
general/constructor_initializer_invalid: RuntimeError
general/covariant_field: TypeCheckError
general/covariant_generic: RuntimeError
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 545d83e..1619610 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -87,6 +87,9 @@
general/bad_setter_abstract: FormatterCrash
general/bug31124: FormatterCrash
general/clone_function_type: FormatterCrash
+general/constants/js_semantics/number_folds: FormatterCrash
+general/constants/number_folds: FormatterCrash
+general/constants/various: FormatterCrash
general/constructor_initializer_invalid: FormatterCrash
general/duplicated_declarations: FormatterCrash
general/error_recovery/annotations: FormatterCrash
diff --git a/pkg/front_end/tool/_fasta/generate_messages.dart b/pkg/front_end/tool/_fasta/generate_messages.dart
index 2a47606..5eeb061 100644
--- a/pkg/front_end/tool/_fasta/generate_messages.dart
+++ b/pkg/front_end/tool/_fasta/generate_messages.dart
@@ -246,6 +246,13 @@
conversions.add("name4 = demangleMixinApplicationName(name4);");
break;
+ case "nameOKEmpty":
+ parameters.add("String nameOKEmpty");
+ conversions.add("if (nameOKEmpty == null || nameOKEmpty.isEmpty) "
+ "nameOKEmpty = '(unnamed)';");
+ arguments.add("'nameOKEmpty': nameOKEmpty");
+ break;
+
case "names":
parameters.add("List<String> _names");
conversions.add("if (_names.isEmpty) throw 'No names provided';");
@@ -283,6 +290,13 @@
arguments.add("'string3': string3");
break;
+ case "stringOKEmpty":
+ parameters.add("String stringOKEmpty");
+ conversions.add("if (stringOKEmpty == null || stringOKEmpty.isEmpty) "
+ "stringOKEmpty = '(empty)';");
+ arguments.add("'stringOKEmpty': stringOKEmpty");
+ break;
+
case "type":
case "type2":
case "type3":
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 9a2682b..c0f3e48 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4342,6 +4342,7 @@
/// Expression of form `x && y` or `x || y`
class LogicalExpression extends Expression {
Expression left;
+ // TODO(jensj): `??` is not supported and we shouldn't say so.
String operator; // && or || or ??
Expression right;
@@ -8952,6 +8953,8 @@
printer.write(escapeString(value));
printer.write('"');
}
+
+ String toString() => 'StringConstant(${toStringInternal()})';
}
class SymbolConstant extends Constant {
@@ -8966,7 +8969,7 @@
R acceptReference<R>(Visitor<R> v) => v.visitSymbolConstantReference(this);
@override
- String toString() => 'StringConstant(${toStringInternal()})';
+ String toString() => 'SymbolConstant(${toStringInternal()})';
int get hashCode => _Hash.hash2(name, libraryReference);