From 5ade5079b13c2f0f4c33a6d41ff0be5d065c09bb Mon Sep 17 00:00:00 2001 From: Kevin Millikin Date: Wed, 19 Jun 2019 15:06:05 +0000 Subject: [PATCH] [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 Reviewed-by: Dan Rubel --- .../lib/src/fasta/fasta_codes_generated.dart | 8 ---- .../lib/src/fasta/kernel/body_builder.dart | 5 -- .../src/fasta/kernel/inference_visitor.dart | 48 +++++++++---------- .../lib/src/fasta/target_implementation.dart | 3 -- pkg/front_end/messages.status | 2 - pkg/front_end/messages.yaml | 3 -- pkg/front_end/test/fasta/testing/suite.dart | 6 --- 7 files changed, 22 insertions(+), 53 deletions(-) diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart index e61cf1c2f00..eb1291a9c35 100644 --- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart +++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart @@ -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 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 codeSetOrMapLiteralTooManyTypeArguments = messageSetOrMapLiteralTooManyTypeArguments; diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart index cd2d3139a2f..71c58dc4808 100644 --- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart +++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart @@ -2504,11 +2504,6 @@ abstract class BodyBuilder extends ScopeListener expressions, leftBrace.endGroup); library.checkBoundsInSetLiteral(node, typeEnvironment, uri); - if (!library.loader.target.enableSetLiterals) { - internalProblem( - fasta.messageSetLiteralsNotSupported, node.fileOffset, uri); - return; - } push(node); } diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart index 7b2f7f549ce..67a503d3fad 100644 --- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart +++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart @@ -1278,34 +1278,30 @@ class InferenceVisitor extends BodyVisitor1 { 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; } } } diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart index 2ca6f7787ff..586100d8cf7 100644 --- a/pkg/front_end/lib/src/fasta/target_implementation.dart +++ b/pkg/front_end/lib/src/fasta/target_implementation.dart @@ -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 diff --git a/pkg/front_end/messages.status b/pkg/front_end/messages.status index 7e5143dd7c5..db100bb106e 100644 --- a/pkg/front_end/messages.status +++ b/pkg/front_end/messages.status @@ -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 diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml index 8f1b9218f0a..8f8a623a547 100644 --- a/pkg/front_end/messages.yaml +++ b/pkg/front_end/messages.yaml @@ -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 diff --git a/pkg/front_end/test/fasta/testing/suite.dart b/pkg/front_end/test/fasta/testing/suite.dart index cc7787708b5..c183abde75e 100644 --- a/pkg/front_end/test/fasta/testing/suite.dart +++ b/pkg/front_end/test/fasta/testing/suite.dart @@ -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 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.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 { ..experimentalFlags = { ExperimentalFlag.controlFlowCollections: context.enableControlFlowCollections, - ExperimentalFlag.setLiterals: context.enableSetLiterals, ExperimentalFlag.spreadCollections: context.enableSpreadCollections, }, inputs: [description.uri]);