Add front-end test for set/map literal disambiguation.

The test exposes three problems:

- The disambiguation criterion in the type inference is incorrect, as
  it infers a map when the context is a LinkedHashSet. This will be
  fixed in an upcoming CL.

- Assigning a map literal to a LinkedHashMap produces a static error
  ("isn't of expected type") due to exact types. Rules for exact types
  are currently unspecified, and the language team has expressed some
  interest in allowing this case. See also
  https://github.com/dart-lang/sdk/issues/33307

- Type arguments for the map literal are not inferred from the context
  when the outer context type is a LinkedHashMap. This is consistent
  between the CFE and analyzer. If the LinkedHashMap case is to be
  supported, this must be fixed as well.

Change-Id: I1519c844dae1f599306446c992cfe4825e4f20d4
Reviewed-on: https://dart-review.googlesource.com/c/88726
Reviewed-by: Peter von der Ahé <ahe@google.com>
diff --git a/pkg/front_end/testcases/legacy.status b/pkg/front_end/testcases/legacy.status
index 04f06f8..e603fd2 100644
--- a/pkg/front_end/testcases/legacy.status
+++ b/pkg/front_end/testcases/legacy.status
@@ -125,6 +125,7 @@
 runtime_checks_new/mixin_forwarding_stub_getter: RuntimeError # Test exercises strong mode semantics
 runtime_checks_new/mixin_forwarding_stub_setter: RuntimeError # Test exercises strong mode semantics
 runtime_checks_new/stub_checked_via_target: RuntimeError # Test exercises strong mode semantics
+set_literals/disambiguation_rule: RuntimeError
 type_variable_as_super: Fail
 uninitialized_fields: Fail # Fasta and dartk disagree on static initializers
 void_methods: Fail # Bad return from setters.
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart
new file mode 100644
index 0000000..15f76e8
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2019, 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:async' show FutureOr;
+
+import 'dart:collection' show LinkedHashMap, LinkedHashSet;
+
+main() async {
+  Map<int, bool> m = {};
+  Set<int> s = {};
+  Iterable<int> i = {};
+  LinkedHashSet<int> lhs = {};
+  LinkedHashMap<int, bool> lhm = {};
+
+  Map<int, bool> fm = await mapfun();
+  Set<int> fs = await setfun();
+  Iterable<int> fi = await iterablefun();
+  LinkedHashSet<int> flhs = await lhsfun();
+  LinkedHashMap<int, bool> flhm = await lhmfun();
+
+  Map<int, bool> fm2 = await mapfun2();
+  Set<int> fs2 = await setfun2();
+  Iterable<int> fi2 = await iterablefun2();
+  LinkedHashSet<int> flhs2 = await lhsfun2();
+  LinkedHashMap<int, bool> flhm2 = await lhmfun2();
+}
+
+Future<Map<int, bool>> mapfun() async => {};
+Future<Set<int>> setfun() async => {};
+Future<Iterable<int>> iterablefun() async => {};
+Future<LinkedHashSet<int>> lhsfun() async => {};
+Future<LinkedHashMap<int, bool>> lhmfun() async => {};
+
+FutureOr<Map<int, bool>> mapfun2() => {};
+FutureOr<Set<int>> setfun2() => {};
+FutureOr<Iterable<int>> iterablefun2() => {};
+FutureOr<LinkedHashSet<int>> lhsfun2() => {};
+FutureOr<LinkedHashMap<int, bool>> lhmfun2() => {};
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.expect b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.expect
new file mode 100644
index 0000000..932c7ea
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.expect
@@ -0,0 +1,43 @@
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+import "dart:async" as asy;
+
+static method main() → dynamic async {
+  core::Map<core::int, core::bool> m = <dynamic, dynamic>{};
+  core::Set<core::int> s = <dynamic, dynamic>{};
+  core::Iterable<core::int> i = <dynamic, dynamic>{};
+  col::LinkedHashSet<core::int> lhs = <dynamic, dynamic>{};
+  col::LinkedHashMap<core::int, core::bool> lhm = <dynamic, dynamic>{};
+  core::Map<core::int, core::bool> fm = await self::mapfun();
+  core::Set<core::int> fs = await self::setfun();
+  core::Iterable<core::int> fi = await self::iterablefun();
+  col::LinkedHashSet<core::int> flhs = await self::lhsfun();
+  col::LinkedHashMap<core::int, core::bool> flhm = await self::lhmfun();
+  core::Map<core::int, core::bool> fm2 = await self::mapfun2();
+  core::Set<core::int> fs2 = await self::setfun2();
+  core::Iterable<core::int> fi2 = await self::iterablefun2();
+  col::LinkedHashSet<core::int> flhs2 = await self::lhsfun2();
+  col::LinkedHashMap<core::int, core::bool> flhm2 = await self::lhmfun2();
+}
+static method mapfun() → asy::Future<core::Map<core::int, core::bool>> async 
+  return <dynamic, dynamic>{};
+static method setfun() → asy::Future<core::Set<core::int>> async 
+  return <dynamic, dynamic>{};
+static method iterablefun() → asy::Future<core::Iterable<core::int>> async 
+  return <dynamic, dynamic>{};
+static method lhsfun() → asy::Future<col::LinkedHashSet<core::int>> async 
+  return <dynamic, dynamic>{};
+static method lhmfun() → asy::Future<col::LinkedHashMap<core::int, core::bool>> async 
+  return <dynamic, dynamic>{};
+static method mapfun2() → asy::FutureOr<core::Map<core::int, core::bool>>
+  return <dynamic, dynamic>{};
+static method setfun2() → asy::FutureOr<core::Set<core::int>>
+  return <dynamic, dynamic>{};
+static method iterablefun2() → asy::FutureOr<core::Iterable<core::int>>
+  return <dynamic, dynamic>{};
+static method lhsfun2() → asy::FutureOr<col::LinkedHashSet<core::int>>
+  return <dynamic, dynamic>{};
+static method lhmfun2() → asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>
+  return <dynamic, dynamic>{};
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.transformed.expect b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.transformed.expect
new file mode 100644
index 0000000..7ed15e3
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.legacy.transformed.expect
@@ -0,0 +1,202 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+static method main() → dynamic /* originally async */ {
+  final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+  asy::FutureOr<dynamic> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  dynamic :saved_try_context_var0;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L1:
+      {
+        core::Map<core::int, core::bool> m = <dynamic, dynamic>{};
+        core::Set<core::int> s = <dynamic, dynamic>{};
+        core::Iterable<core::int> i = <dynamic, dynamic>{};
+        col::LinkedHashSet<core::int> lhs = <dynamic, dynamic>{};
+        col::LinkedHashMap<core::int, core::bool> lhm = <dynamic, dynamic>{};
+        [yield] let dynamic #t1 = asy::_awaitHelper(self::mapfun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Map<core::int, core::bool> fm = :result;
+        [yield] let dynamic #t2 = asy::_awaitHelper(self::setfun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Set<core::int> fs = :result;
+        [yield] let dynamic #t3 = asy::_awaitHelper(self::iterablefun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Iterable<core::int> fi = :result;
+        [yield] let dynamic #t4 = asy::_awaitHelper(self::lhsfun(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashSet<core::int> flhs = :result;
+        [yield] let dynamic #t5 = asy::_awaitHelper(self::lhmfun(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashMap<core::int, core::bool> flhm = :result;
+        [yield] let dynamic #t6 = asy::_awaitHelper(self::mapfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Map<core::int, core::bool> fm2 = :result;
+        [yield] let dynamic #t7 = asy::_awaitHelper(self::setfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Set<core::int> fs2 = :result;
+        [yield] let dynamic #t8 = asy::_awaitHelper(self::iterablefun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Iterable<core::int> fi2 = :result;
+        [yield] let dynamic #t9 = asy::_awaitHelper(self::lhsfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashSet<core::int> flhs2 = :result;
+        [yield] let dynamic #t10 = asy::_awaitHelper(self::lhmfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashMap<core::int, core::bool> flhm2 = :result;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method mapfun() → asy::Future<core::Map<core::int, core::bool>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Map<core::int, core::bool>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Map<core::int, core::bool>>();
+  asy::FutureOr<core::Map<core::int, core::bool>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L2:
+      {
+        :return_value = <dynamic, dynamic>{};
+        break #L2;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method setfun() → asy::Future<core::Set<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Set<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Set<core::int>>();
+  asy::FutureOr<core::Set<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L3:
+      {
+        :return_value = <dynamic, dynamic>{};
+        break #L3;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method iterablefun() → asy::Future<core::Iterable<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Iterable<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Iterable<core::int>>();
+  asy::FutureOr<core::Iterable<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L4:
+      {
+        :return_value = <dynamic, dynamic>{};
+        break #L4;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method lhsfun() → asy::Future<col::LinkedHashSet<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<col::LinkedHashSet<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<col::LinkedHashSet<core::int>>();
+  asy::FutureOr<col::LinkedHashSet<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L5:
+      {
+        :return_value = <dynamic, dynamic>{};
+        break #L5;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method lhmfun() → asy::Future<col::LinkedHashMap<core::int, core::bool>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<col::LinkedHashMap<core::int, core::bool>> :async_completer = new asy::_AsyncAwaitCompleter::•<col::LinkedHashMap<core::int, core::bool>>();
+  asy::FutureOr<col::LinkedHashMap<core::int, core::bool>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L6:
+      {
+        :return_value = <dynamic, dynamic>{};
+        break #L6;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method mapfun2() → asy::FutureOr<core::Map<core::int, core::bool>>
+  return <dynamic, dynamic>{};
+static method setfun2() → asy::FutureOr<core::Set<core::int>>
+  return <dynamic, dynamic>{};
+static method iterablefun2() → asy::FutureOr<core::Iterable<core::int>>
+  return <dynamic, dynamic>{};
+static method lhsfun2() → asy::FutureOr<col::LinkedHashSet<core::int>>
+  return <dynamic, dynamic>{};
+static method lhmfun2() → asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>
+  return <dynamic, dynamic>{};
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.outline.expect b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.outline.expect
new file mode 100644
index 0000000..4c67211
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.outline.expect
@@ -0,0 +1,28 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+static method main() → dynamic
+  ;
+static method mapfun() → asy::Future<core::Map<core::int, core::bool>>
+  ;
+static method setfun() → asy::Future<core::Set<core::int>>
+  ;
+static method iterablefun() → asy::Future<core::Iterable<core::int>>
+  ;
+static method lhsfun() → asy::Future<col::LinkedHashSet<core::int>>
+  ;
+static method lhmfun() → asy::Future<col::LinkedHashMap<core::int, core::bool>>
+  ;
+static method mapfun2() → asy::FutureOr<core::Map<core::int, core::bool>>
+  ;
+static method setfun2() → asy::FutureOr<core::Set<core::int>>
+  ;
+static method iterablefun2() → asy::FutureOr<core::Iterable<core::int>>
+  ;
+static method lhsfun2() → asy::FutureOr<col::LinkedHashSet<core::int>>
+  ;
+static method lhmfun2() → asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>
+  ;
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.expect b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.expect
new file mode 100644
index 0000000..61763c1
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.expect
@@ -0,0 +1,123 @@
+// Formatted problems:
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:13:28: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'LinkedHashSet<int>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'LinkedHashSet' is from 'dart:collection'.
+// Try changing the type of the left hand side, or casting the right hand side to 'LinkedHashSet<int>'.
+//   LinkedHashSet<int> lhs = {};
+//                            ^
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:14:34: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'LinkedHashMap' is from 'dart:collection'.
+// Change the type of the map literal or the context in which it is used.
+//   LinkedHashMap<int, bool> lhm = {};
+//                                  ^
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:32:46: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'FutureOr' is from 'dart:async'.
+//  - 'LinkedHashSet' is from 'dart:collection'.
+// Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+// Future<LinkedHashSet<int>> lhsfun() async => {};
+//                                              ^
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:33:52: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'LinkedHashMap' is from 'dart:collection'.
+// Change the type of the map literal or the context in which it is used.
+// Future<LinkedHashMap<int, bool>> lhmfun() async => {};
+//                                                    ^
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:38:43: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'FutureOr' is from 'dart:async'.
+//  - 'LinkedHashSet' is from 'dart:collection'.
+// Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+// FutureOr<LinkedHashSet<int>> lhsfun2() => {};
+//                                           ^
+//
+// pkg/front_end/testcases/set_literals/disambiguation_rule.dart:39:49: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashMap<int, bool>>'.
+//  - 'Map' is from 'dart:core'.
+//  - 'FutureOr' is from 'dart:async'.
+//  - 'LinkedHashMap' is from 'dart:collection'.
+// Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashMap<int, bool>>'.
+// FutureOr<LinkedHashMap<int, bool>> lhmfun2() => {};
+//                                                 ^
+
+library;
+import self as self;
+import "dart:core" as core;
+import "dart:collection" as col;
+import "dart:async" as asy;
+
+static method main() → dynamic async {
+  core::Map<core::int, core::bool> m = <core::int, core::bool>{};
+  core::Set<core::int> s = let final core::Set<core::int> #t1 = col::LinkedHashSet::•<core::int>() in #t1;
+  core::Iterable<core::int> i = let final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>() in #t2;
+  col::LinkedHashSet<core::int> lhs = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:13:28: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'LinkedHashSet<int>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'LinkedHashSet<int>'.
+  LinkedHashSet<int> lhs = {};
+                           ^" in <dynamic, dynamic>{} as{TypeError} col::LinkedHashSet<core::int>;
+  col::LinkedHashMap<core::int, core::bool> lhm = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:14:34: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Change the type of the map literal or the context in which it is used.
+  LinkedHashMap<int, bool> lhm = {};
+                                 ^" in <dynamic, dynamic>{};
+  core::Map<core::int, core::bool> fm = await self::mapfun();
+  core::Set<core::int> fs = await self::setfun();
+  core::Iterable<core::int> fi = await self::iterablefun();
+  col::LinkedHashSet<core::int> flhs = await self::lhsfun();
+  col::LinkedHashMap<core::int, core::bool> flhm = await self::lhmfun();
+  core::Map<core::int, core::bool> fm2 = await self::mapfun2();
+  core::Set<core::int> fs2 = await self::setfun2();
+  core::Iterable<core::int> fi2 = await self::iterablefun2();
+  col::LinkedHashSet<core::int> flhs2 = await self::lhsfun2();
+  col::LinkedHashMap<core::int, core::bool> flhm2 = await self::lhmfun2();
+}
+static method mapfun() → asy::Future<core::Map<core::int, core::bool>> async 
+  return <core::int, core::bool>{};
+static method setfun() → asy::Future<core::Set<core::int>> async 
+  return let final core::Set<core::int> #t5 = col::LinkedHashSet::•<core::int>() in #t5;
+static method iterablefun() → asy::Future<core::Iterable<core::int>> async 
+  return let final core::Set<core::int> #t6 = col::LinkedHashSet::•<core::int>() in #t6;
+static method lhsfun() → asy::Future<col::LinkedHashSet<core::int>> async 
+  return let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:32:46: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+Future<LinkedHashSet<int>> lhsfun() async => {};
+                                             ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashSet<core::int>>;
+static method lhmfun() → asy::Future<col::LinkedHashMap<core::int, core::bool>> async 
+  return let final<BottomType> #t8 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:33:52: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Change the type of the map literal or the context in which it is used.
+Future<LinkedHashMap<int, bool>> lhmfun() async => {};
+                                                   ^" in <dynamic, dynamic>{};
+static method mapfun2() → asy::FutureOr<core::Map<core::int, core::bool>>
+  return <core::int, core::bool>{};
+static method setfun2() → asy::FutureOr<core::Set<core::int>>
+  return let final core::Set<core::int> #t9 = col::LinkedHashSet::•<core::int>() in #t9;
+static method iterablefun2() → asy::FutureOr<core::Iterable<core::int>>
+  return let final core::Set<core::int> #t10 = col::LinkedHashSet::•<core::int>() in #t10;
+static method lhsfun2() → asy::FutureOr<col::LinkedHashSet<core::int>>
+  return let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:38:43: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+FutureOr<LinkedHashSet<int>> lhsfun2() => {};
+                                          ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashSet<core::int>>;
+static method lhmfun2() → asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>
+  return let final<BottomType> #t12 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:39:49: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashMap<int, bool>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashMap<int, bool>>'.
+FutureOr<LinkedHashMap<int, bool>> lhmfun2() => {};
+                                                ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>;
diff --git a/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.transformed.expect b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.transformed.expect
new file mode 100644
index 0000000..7d2fe7c
--- /dev/null
+++ b/pkg/front_end/testcases/set_literals/disambiguation_rule.dart.strong.transformed.expect
@@ -0,0 +1,235 @@
+library;
+import self as self;
+import "dart:async" as asy;
+import "dart:core" as core;
+import "dart:collection" as col;
+
+static method main() → dynamic /* originally async */ {
+  final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>();
+  asy::FutureOr<dynamic> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  dynamic :saved_try_context_var0;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L1:
+      {
+        core::Map<core::int, core::bool> m = <core::int, core::bool>{};
+        core::Set<core::int> s = let final core::Set<core::int> #t1 = col::LinkedHashSet::•<core::int>() in #t1;
+        core::Iterable<core::int> i = let final core::Set<core::int> #t2 = col::LinkedHashSet::•<core::int>() in #t2;
+        col::LinkedHashSet<core::int> lhs = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:13:28: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'LinkedHashSet<int>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'LinkedHashSet<int>'.
+  LinkedHashSet<int> lhs = {};
+                           ^" in <dynamic, dynamic>{} as{TypeError} col::LinkedHashSet<core::int>;
+        col::LinkedHashMap<core::int, core::bool> lhm = let final<BottomType> #t4 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:14:34: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Change the type of the map literal or the context in which it is used.
+  LinkedHashMap<int, bool> lhm = {};
+                                 ^" in <dynamic, dynamic>{};
+        [yield] let dynamic #t5 = asy::_awaitHelper(self::mapfun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Map<core::int, core::bool> fm = :result;
+        [yield] let dynamic #t6 = asy::_awaitHelper(self::setfun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Set<core::int> fs = :result;
+        [yield] let dynamic #t7 = asy::_awaitHelper(self::iterablefun(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Iterable<core::int> fi = :result;
+        [yield] let dynamic #t8 = asy::_awaitHelper(self::lhsfun(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashSet<core::int> flhs = :result;
+        [yield] let dynamic #t9 = asy::_awaitHelper(self::lhmfun(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashMap<core::int, core::bool> flhm = :result;
+        [yield] let dynamic #t10 = asy::_awaitHelper(self::mapfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Map<core::int, core::bool> fm2 = :result;
+        [yield] let dynamic #t11 = asy::_awaitHelper(self::setfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Set<core::int> fs2 = :result;
+        [yield] let dynamic #t12 = asy::_awaitHelper(self::iterablefun2(), :async_op_then, :async_op_error, :async_op) in null;
+        core::Iterable<core::int> fi2 = :result;
+        [yield] let dynamic #t13 = asy::_awaitHelper(self::lhsfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashSet<core::int> flhs2 = :result;
+        [yield] let dynamic #t14 = asy::_awaitHelper(self::lhmfun2(), :async_op_then, :async_op_error, :async_op) in null;
+        col::LinkedHashMap<core::int, core::bool> flhm2 = :result;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method mapfun() → asy::Future<core::Map<core::int, core::bool>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Map<core::int, core::bool>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Map<core::int, core::bool>>();
+  asy::FutureOr<core::Map<core::int, core::bool>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L2:
+      {
+        :return_value = <core::int, core::bool>{};
+        break #L2;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method setfun() → asy::Future<core::Set<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Set<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Set<core::int>>();
+  asy::FutureOr<core::Set<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L3:
+      {
+        :return_value = let final core::Set<core::int> #t15 = col::LinkedHashSet::•<core::int>() in #t15;
+        break #L3;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method iterablefun() → asy::Future<core::Iterable<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<core::Iterable<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<core::Iterable<core::int>>();
+  asy::FutureOr<core::Iterable<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L4:
+      {
+        :return_value = let final core::Set<core::int> #t16 = col::LinkedHashSet::•<core::int>() in #t16;
+        break #L4;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method lhsfun() → asy::Future<col::LinkedHashSet<core::int>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<col::LinkedHashSet<core::int>> :async_completer = new asy::_AsyncAwaitCompleter::•<col::LinkedHashSet<core::int>>();
+  asy::FutureOr<col::LinkedHashSet<core::int>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L5:
+      {
+        :return_value = let final<BottomType> #t17 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:32:46: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+Future<LinkedHashSet<int>> lhsfun() async => {};
+                                             ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashSet<core::int>>;
+        break #L5;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method lhmfun() → asy::Future<col::LinkedHashMap<core::int, core::bool>> /* originally async */ {
+  final asy::_AsyncAwaitCompleter<col::LinkedHashMap<core::int, core::bool>> :async_completer = new asy::_AsyncAwaitCompleter::•<col::LinkedHashMap<core::int, core::bool>>();
+  asy::FutureOr<col::LinkedHashMap<core::int, core::bool>> :return_value;
+  dynamic :async_stack_trace;
+  dynamic :async_op_then;
+  dynamic :async_op_error;
+  dynamic :await_jump_var = 0;
+  dynamic :await_ctx_var;
+  function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding 
+    try {
+      #L6:
+      {
+        :return_value = let final<BottomType> #t18 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:33:52: Error: The map literal type 'Map<dynamic, dynamic>' isn't of expected type 'LinkedHashMap<int, bool>'.
+ - 'Map' is from 'dart:core'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Change the type of the map literal or the context in which it is used.
+Future<LinkedHashMap<int, bool>> lhmfun() async => {};
+                                                   ^" in <dynamic, dynamic>{};
+        break #L6;
+      }
+      asy::_completeOnAsyncReturn(:async_completer, :return_value);
+      return;
+    }
+    on dynamic catch(dynamic :exception, dynamic :stack_trace) {
+      :async_completer.{asy::Completer::completeError}(:exception, :stack_trace);
+    }
+  :async_stack_trace = asy::_asyncStackTraceHelper(:async_op);
+  :async_op_then = asy::_asyncThenWrapperHelper(:async_op);
+  :async_op_error = asy::_asyncErrorWrapperHelper(:async_op);
+  :async_completer.start(:async_op);
+  return :async_completer.{asy::Completer::future};
+}
+static method mapfun2() → asy::FutureOr<core::Map<core::int, core::bool>>
+  return <core::int, core::bool>{};
+static method setfun2() → asy::FutureOr<core::Set<core::int>>
+  return let final core::Set<core::int> #t19 = col::LinkedHashSet::•<core::int>() in #t19;
+static method iterablefun2() → asy::FutureOr<core::Iterable<core::int>>
+  return let final core::Set<core::int> #t20 = col::LinkedHashSet::•<core::int>() in #t20;
+static method lhsfun2() → asy::FutureOr<col::LinkedHashSet<core::int>>
+  return let final<BottomType> #t21 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:38:43: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashSet<int>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashSet' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashSet<int>>'.
+FutureOr<LinkedHashSet<int>> lhsfun2() => {};
+                                          ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashSet<core::int>>;
+static method lhmfun2() → asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>
+  return let final<BottomType> #t22 = invalid-expression "pkg/front_end/testcases/set_literals/disambiguation_rule.dart:39:49: Error: A value of type 'Map<dynamic, dynamic>' can't be assigned to a variable of type 'FutureOr<LinkedHashMap<int, bool>>'.
+ - 'Map' is from 'dart:core'.
+ - 'FutureOr' is from 'dart:async'.
+ - 'LinkedHashMap' is from 'dart:collection'.
+Try changing the type of the left hand side, or casting the right hand side to 'FutureOr<LinkedHashMap<int, bool>>'.
+FutureOr<LinkedHashMap<int, bool>> lhmfun2() => {};
+                                                ^" in <dynamic, dynamic>{} as{TypeError} asy::FutureOr<col::LinkedHashMap<core::int, core::bool>>;
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 20f95d6..3ab4207 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -145,6 +145,7 @@
 runtime_checks_new/mixin_forwarding_stub_field: TypeCheckError
 runtime_checks_new/mixin_forwarding_stub_getter: TypeCheckError
 runtime_checks_new/mixin_forwarding_stub_setter: TypeCheckError
+set_literals/disambiguation_rule: RuntimeError
 statements: Crash
 type_variable_as_super: RuntimeError
 type_variable_prefix: RuntimeError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index c70d840..0b3f03c 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -950,6 +950,7 @@
 runtime_checks_new/stub_from_interface_covariantImpl_from_interface: TextSerializationFailure # Was: Pass
 runtime_checks_new/stub_from_interface_covariantImpl_from_super: TextSerializationFailure # Was: Pass
 runtime_checks_new/stub_from_interface_covariantInterface_from_class: TextSerializationFailure # Was: Pass
+set_literals/disambiguation_rule: TextSerializationFailure # Was: RuntimeError
 statements: Crash
 static_setter: TextSerializationFailure # Was: Pass
 store_load: TextSerializationFailure # Was: Pass