Skip to content

Commit 5ade507

Browse files
Kevin Millikincommit-bot@chromium.org
authored andcommitted
[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>
1 parent e6647f0 commit 5ade507

7 files changed

Lines changed: 22 additions & 53 deletions

File tree

pkg/front_end/lib/src/fasta/fasta_codes_generated.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8358,14 +8358,6 @@ const MessageCode messageSetLiteralTooManyTypeArguments = const MessageCode(
83588358
severity: Severity.errorLegacyWarning,
83598359
message: r"""A set literal requires exactly one type argument.""");
83608360

8361-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
8362-
const Code<Null> codeSetLiteralsNotSupported = messageSetLiteralsNotSupported;
8363-
8364-
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
8365-
const MessageCode messageSetLiteralsNotSupported = const MessageCode(
8366-
"SetLiteralsNotSupported",
8367-
message: r"""Set literals are not supported yet.""");
8368-
83698361
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
83708362
const Code<Null> codeSetOrMapLiteralTooManyTypeArguments =
83718363
messageSetOrMapLiteralTooManyTypeArguments;

pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,11 +2504,6 @@ abstract class BodyBuilder extends ScopeListener<JumpTarget>
25042504
expressions,
25052505
leftBrace.endGroup);
25062506
library.checkBoundsInSetLiteral(node, typeEnvironment, uri);
2507-
if (!library.loader.target.enableSetLiterals) {
2508-
internalProblem(
2509-
fasta.messageSetLiteralsNotSupported, node.fileOffset, uri);
2510-
return;
2511-
}
25122507
push(node);
25132508
}
25142509

pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,34 +1278,30 @@ class InferenceVisitor extends BodyVisitor1<void, DartType> {
12781278
assert((node.keyType is ImplicitTypeArgument) ==
12791279
(node.valueType is ImplicitTypeArgument));
12801280
bool inferenceNeeded = node.keyType is ImplicitTypeArgument;
1281-
KernelLibraryBuilder library = inferrer.library;
12821281
bool typeContextIsMap = node.keyType is! ImplicitTypeArgument;
12831282
bool typeContextIsIterable = false;
1284-
if (!inferrer.isTopLevel) {
1285-
if (library.loader.target.enableSetLiterals && inferenceNeeded) {
1286-
// Ambiguous set/map literal
1287-
DartType context =
1288-
inferrer.typeSchemaEnvironment.unfutureType(typeContext);
1289-
if (context is InterfaceType) {
1290-
typeContextIsMap = typeContextIsMap ||
1291-
inferrer.classHierarchy
1292-
.isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
1293-
typeContextIsIterable = typeContextIsIterable ||
1294-
inferrer.classHierarchy.isSubtypeOf(
1295-
context.classNode, inferrer.coreTypes.iterableClass);
1296-
if (node.entries.isEmpty &&
1297-
typeContextIsIterable &&
1298-
!typeContextIsMap) {
1299-
// Set literal
1300-
SetLiteralJudgment setLiteral = new SetLiteralJudgment([],
1301-
typeArgument: const ImplicitTypeArgument(),
1302-
isConst: node.isConst)
1303-
..fileOffset = node.fileOffset;
1304-
node.parent.replaceChild(node, setLiteral);
1305-
visitSetLiteralJudgment(setLiteral, typeContext);
1306-
node.inferredType = setLiteral.inferredType;
1307-
return;
1308-
}
1283+
if (!inferrer.isTopLevel && inferenceNeeded) {
1284+
// Ambiguous set/map literal
1285+
DartType context =
1286+
inferrer.typeSchemaEnvironment.unfutureType(typeContext);
1287+
if (context is InterfaceType) {
1288+
typeContextIsMap = typeContextIsMap ||
1289+
inferrer.classHierarchy
1290+
.isSubtypeOf(context.classNode, inferrer.coreTypes.mapClass);
1291+
typeContextIsIterable = typeContextIsIterable ||
1292+
inferrer.classHierarchy.isSubtypeOf(
1293+
context.classNode, inferrer.coreTypes.iterableClass);
1294+
if (node.entries.isEmpty &&
1295+
typeContextIsIterable &&
1296+
!typeContextIsMap) {
1297+
// Set literal
1298+
SetLiteralJudgment setLiteral = new SetLiteralJudgment([],
1299+
typeArgument: const ImplicitTypeArgument(), isConst: node.isConst)
1300+
..fileOffset = node.fileOffset;
1301+
node.parent.replaceChild(node, setLiteral);
1302+
visitSetLiteralJudgment(setLiteral, typeContext);
1303+
node.inferredType = setLiteral.inferredType;
1304+
return;
13091305
}
13101306
}
13111307
}

pkg/front_end/lib/src/fasta/target_implementation.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ abstract class TargetImplementation extends Target {
5252
bool enableControlFlowCollections;
5353
bool enableExtensionMethods;
5454
bool enableNonNullable;
55-
bool enableSetLiterals;
5655
bool enableSpreadCollections;
5756
bool enableTripleShift;
5857

@@ -65,8 +64,6 @@ abstract class TargetImplementation extends Target {
6564
.isExperimentEnabled(ExperimentalFlag.extensionMethods),
6665
enableNonNullable = CompilerContext.current.options
6766
.isExperimentEnabled(ExperimentalFlag.nonNullable),
68-
enableSetLiterals = CompilerContext.current.options
69-
.isExperimentEnabled(ExperimentalFlag.setLiterals),
7067
enableSpreadCollections = CompilerContext.current.options
7168
.isExperimentEnabled(ExperimentalFlag.spreadCollections),
7269
enableTripleShift = CompilerContext.current.options

pkg/front_end/messages.status

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ SdkSummaryNotFound/analyzerCode: Fail
441441
SdkSummaryNotFound/example: Fail
442442
SetLiteralTooManyTypeArguments/analyzerCode: Fail
443443
SetLiteralTooManyTypeArguments/example: Fail
444-
SetLiteralsNotSupported/analyzerCode: Fail
445-
SetLiteralsNotSupported/example: Fail
446444
SetOrMapLiteralTooManyTypeArguments/analyzerCode: Fail
447445
SetOrMapLiteralTooManyTypeArguments/example: Fail
448446
SetterNotFound/example: Fail

pkg/front_end/messages.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,9 +1438,6 @@ SetOrMapLiteralTooManyTypeArguments:
14381438
template: "A set or map literal requires exactly one or two type arguments, respectively."
14391439
severity: ERROR_LEGACY_WARNING
14401440

1441-
SetLiteralsNotSupported:
1442-
template: "Set literals are not supported yet."
1443-
14441441
LoadLibraryTakesNoArguments:
14451442
template: "'loadLibrary' takes no arguments."
14461443
severity: ERROR_LEGACY_WARNING

pkg/front_end/test/fasta/testing/suite.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ class FastaContext extends ChainContext with MatchContext {
132132
final bool legacyMode;
133133
final bool onlyCrashes;
134134
final bool enableControlFlowCollections;
135-
final bool enableSetLiterals;
136135
final bool enableSpreadCollections;
137136
final bool skipVm;
138137
final Map<Component, KernelTarget> componentToTarget =
@@ -158,7 +157,6 @@ class FastaContext extends ChainContext with MatchContext {
158157
this.platformBinaries,
159158
this.onlyCrashes,
160159
this.enableControlFlowCollections,
161-
this.enableSetLiterals,
162160
this.enableSpreadCollections,
163161
bool ignoreExpectations,
164162
this.updateExpectations,
@@ -250,7 +248,6 @@ class FastaContext extends ChainContext with MatchContext {
250248
bool legacyMode = environment.containsKey(LEGACY_MODE);
251249
bool enableControlFlowCollections =
252250
environment["enableControlFlowCollections"] != "false" && !legacyMode;
253-
bool enableSetLiterals = environment["enableSetLiterals"] != "false";
254251
bool enableSpreadCollections =
255252
environment["enableSpreadCollections"] != "false" && !legacyMode;
256253
var options = new ProcessedOptions(
@@ -263,7 +260,6 @@ class FastaContext extends ChainContext with MatchContext {
263260
..experimentalFlags = <ExperimentalFlag, bool>{
264261
ExperimentalFlag.controlFlowCollections:
265262
enableControlFlowCollections,
266-
ExperimentalFlag.setLiterals: enableSetLiterals,
267263
ExperimentalFlag.spreadCollections: enableSpreadCollections,
268264
});
269265
UriTranslator uriTranslator = await options.getUriTranslator();
@@ -286,7 +282,6 @@ class FastaContext extends ChainContext with MatchContext {
286282
: Uri.base.resolve(platformBinaries),
287283
onlyCrashes,
288284
enableControlFlowCollections,
289-
enableSetLiterals,
290285
enableSpreadCollections,
291286
ignoreExpectations,
292287
updateExpectations,
@@ -356,7 +351,6 @@ class Outline extends Step<TestDescription, Component, FastaContext> {
356351
..experimentalFlags = <ExperimentalFlag, bool>{
357352
ExperimentalFlag.controlFlowCollections:
358353
context.enableControlFlowCollections,
359-
ExperimentalFlag.setLiterals: context.enableSetLiterals,
360354
ExperimentalFlag.spreadCollections: context.enableSpreadCollections,
361355
},
362356
inputs: <Uri>[description.uri]);

0 commit comments

Comments
 (0)