[cfe] Remove the set-literals experimental flag

This flag has been enabled since Dart 2.2.0.

Change-Id: I18e77e1659d4be1aaf06e1c2a6262ae9e8c7f922
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104760
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
This commit is contained in:
Kevin Millikin 2019-06-19 15:06:05 +00:00 committed by commit-bot@chromium.org
parent e6647f0769
commit 5ade5079b1
7 changed files with 22 additions and 53 deletions

View file

@ -8358,14 +8358,6 @@ const MessageCode messageSetLiteralTooManyTypeArguments = const MessageCode(
severity: Severity.errorLegacyWarning,
message: r"""A set literal requires exactly one type argument.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeSetLiteralsNotSupported = messageSetLiteralsNotSupported;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const MessageCode messageSetLiteralsNotSupported = const MessageCode(
"SetLiteralsNotSupported",
message: r"""Set literals are not supported yet.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeSetOrMapLiteralTooManyTypeArguments =
messageSetOrMapLiteralTooManyTypeArguments;

View file

@ -2504,11 +2504,6 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
expressions,
leftBrace.endGroup);
library.checkBoundsInSetLiteral(node, typeEnvironment, uri);
if (!library.loader.target.enableSetLiterals) {
internalProblem(
fasta.messageSetLiteralsNotSupported, node.fileOffset, uri);
return;
}
push(node);
}

View file

@ -1278,34 +1278,30 @@ class InferenceVisitor extends BodyVisitor1<void, DartType> {
assert((node.keyType is ImplicitTypeArgument) ==
(node.valueType is ImplicitTypeArgument));
bool inferenceNeeded = node.keyType is ImplicitTypeArgument;
KernelLibraryBuilder library = inferrer.library;
bool typeContextIsMap = node.keyType is! ImplicitTypeArgument;
bool typeContextIsIterable = false;
if (!inferrer.isTopLevel) {
if (library.loader.target.enableSetLiterals && inferenceNeeded) {
// Ambiguous set/map literal
DartType context =
inferrer.typeSchemaEnvironment.unfutureType(typeContext);
if (context is InterfaceType) {
typeContextIsMap = typeContextIsMap ||
inferrer.classHierarchy
.isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
typeContextIsIterable = typeContextIsIterable ||
inferrer.classHierarchy.isSubtypeOf(
context.classNode, inferrer.coreTypes.iterableClass);
if (node.entries.isEmpty &&
typeContextIsIterable &&
!typeContextIsMap) {
// Set literal
SetLiteralJudgment setLiteral = new SetLiteralJudgment([],
typeArgument: const ImplicitTypeArgument(),
isConst: node.isConst)
..fileOffset = node.fileOffset;
node.parent.replaceChild(node, setLiteral);
visitSetLiteralJudgment(setLiteral, typeContext);
node.inferredType = setLiteral.inferredType;
return;
}
if (!inferrer.isTopLevel && inferenceNeeded) {
// Ambiguous set/map literal
DartType context =
inferrer.typeSchemaEnvironment.unfutureType(typeContext);
if (context is InterfaceType) {
typeContextIsMap = typeContextIsMap ||
inferrer.classHierarchy
.isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
typeContextIsIterable = typeContextIsIterable ||
inferrer.classHierarchy.isSubtypeOf(
context.classNode, inferrer.coreTypes.iterableClass);
if (node.entries.isEmpty &&
typeContextIsIterable &&
!typeContextIsMap) {
// Set literal
SetLiteralJudgment setLiteral = new SetLiteralJudgment([],
typeArgument: const ImplicitTypeArgument(), isConst: node.isConst)
..fileOffset = node.fileOffset;
node.parent.replaceChild(node, setLiteral);
visitSetLiteralJudgment(setLiteral, typeContext);
node.inferredType = setLiteral.inferredType;
return;
}
}
}

View file

@ -52,7 +52,6 @@ abstract class TargetImplementation extends Target {
bool enableControlFlowCollections;
bool enableExtensionMethods;
bool enableNonNullable;
bool enableSetLiterals;
bool enableSpreadCollections;
bool enableTripleShift;
@ -65,8 +64,6 @@ abstract class TargetImplementation extends Target {
.isExperimentEnabled(ExperimentalFlag.extensionMethods),
enableNonNullable = CompilerContext.current.options
.isExperimentEnabled(ExperimentalFlag.nonNullable),
enableSetLiterals = CompilerContext.current.options
.isExperimentEnabled(ExperimentalFlag.setLiterals),
enableSpreadCollections = CompilerContext.current.options
.isExperimentEnabled(ExperimentalFlag.spreadCollections),
enableTripleShift = CompilerContext.current.options

View file

@ -441,8 +441,6 @@ SdkSummaryNotFound/analyzerCode: Fail
SdkSummaryNotFound/example: Fail
SetLiteralTooManyTypeArguments/analyzerCode: Fail
SetLiteralTooManyTypeArguments/example: Fail
SetLiteralsNotSupported/analyzerCode: Fail
SetLiteralsNotSupported/example: Fail
SetOrMapLiteralTooManyTypeArguments/analyzerCode: Fail
SetOrMapLiteralTooManyTypeArguments/example: Fail
SetterNotFound/example: Fail

View file

@ -1438,9 +1438,6 @@ SetOrMapLiteralTooManyTypeArguments:
template: "A set or map literal requires exactly one or two type arguments, respectively."
severity: ERROR_LEGACY_WARNING
SetLiteralsNotSupported:
template: "Set literals are not supported yet."
LoadLibraryTakesNoArguments:
template: "'loadLibrary' takes no arguments."
severity: ERROR_LEGACY_WARNING

View file

@ -132,7 +132,6 @@ class FastaContext extends ChainContext with MatchContext {
final bool legacyMode;
final bool onlyCrashes;
final bool enableControlFlowCollections;
final bool enableSetLiterals;
final bool enableSpreadCollections;
final bool skipVm;
final Map<Component, KernelTarget> componentToTarget =
@ -158,7 +157,6 @@ class FastaContext extends ChainContext with MatchContext {
this.platformBinaries,
this.onlyCrashes,
this.enableControlFlowCollections,
this.enableSetLiterals,
this.enableSpreadCollections,
bool ignoreExpectations,
this.updateExpectations,
@ -250,7 +248,6 @@ class FastaContext extends ChainContext with MatchContext {
bool legacyMode = environment.containsKey(LEGACY_MODE);
bool enableControlFlowCollections =
environment["enableControlFlowCollections"] != "false" && !legacyMode;
bool enableSetLiterals = environment["enableSetLiterals"] != "false";
bool enableSpreadCollections =
environment["enableSpreadCollections"] != "false" && !legacyMode;
var options = new ProcessedOptions(
@ -263,7 +260,6 @@ class FastaContext extends ChainContext with MatchContext {
..experimentalFlags = <ExperimentalFlag, bool>{
ExperimentalFlag.controlFlowCollections:
enableControlFlowCollections,
ExperimentalFlag.setLiterals: enableSetLiterals,
ExperimentalFlag.spreadCollections: enableSpreadCollections,
});
UriTranslator uriTranslator = await options.getUriTranslator();
@ -286,7 +282,6 @@ class FastaContext extends ChainContext with MatchContext {
: Uri.base.resolve(platformBinaries),
onlyCrashes,
enableControlFlowCollections,
enableSetLiterals,
enableSpreadCollections,
ignoreExpectations,
updateExpectations,
@ -356,7 +351,6 @@ class Outline extends Step<TestDescription, Component, FastaContext> {
..experimentalFlags = <ExperimentalFlag, bool>{
ExperimentalFlag.controlFlowCollections:
context.enableControlFlowCollections,
ExperimentalFlag.setLiterals: context.enableSetLiterals,
ExperimentalFlag.spreadCollections: context.enableSpreadCollections,
},
inputs: <Uri>[description.uri]);