[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>
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 e61cf1c..eb1291a 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -8359,14 +8359,6 @@
     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;
 
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 cd2d313..71c58dc 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 @@
         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 7b2f7f5..67a503d 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 @@
     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 2ca6f77..586100d 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 @@
   bool enableControlFlowCollections;
   bool enableExtensionMethods;
   bool enableNonNullable;
-  bool enableSetLiterals;
   bool enableSpreadCollections;
   bool enableTripleShift;
 
@@ -65,8 +64,6 @@
             .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 7e5143d..db100bb 100644
--- a/pkg/front_end/messages.status
+++ b/pkg/front_end/messages.status
@@ -441,8 +441,6 @@
 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 8f1b921..8f8a623 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -1438,9 +1438,6 @@
   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 cc77877..c183abd 100644
--- a/pkg/front_end/test/fasta/testing/suite.dart
+++ b/pkg/front_end/test/fasta/testing/suite.dart
@@ -132,7 +132,6 @@
   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 @@
       this.platformBinaries,
       this.onlyCrashes,
       this.enableControlFlowCollections,
-      this.enableSetLiterals,
       this.enableSpreadCollections,
       bool ignoreExpectations,
       this.updateExpectations,
@@ -250,7 +248,6 @@
     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 @@
           ..experimentalFlags = <ExperimentalFlag, bool>{
             ExperimentalFlag.controlFlowCollections:
                 enableControlFlowCollections,
-            ExperimentalFlag.setLiterals: enableSetLiterals,
             ExperimentalFlag.spreadCollections: enableSpreadCollections,
           });
     UriTranslator uriTranslator = await options.getUriTranslator();
@@ -286,7 +282,6 @@
             : Uri.base.resolve(platformBinaries),
         onlyCrashes,
         enableControlFlowCollections,
-        enableSetLiterals,
         enableSpreadCollections,
         ignoreExpectations,
         updateExpectations,
@@ -356,7 +351,6 @@
           ..experimentalFlags = <ExperimentalFlag, bool>{
             ExperimentalFlag.controlFlowCollections:
                 context.enableControlFlowCollections,
-            ExperimentalFlag.setLiterals: context.enableSetLiterals,
             ExperimentalFlag.spreadCollections: context.enableSpreadCollections,
           },
         inputs: <Uri>[description.uri]);