dart-sdk/tests/language/spread_collections
Paul Berry 219fe27e3e Front end: Fix follow-on error arising from ill-typed spread element.
When the CFE encounters an ill-typed spread element in an ambiguous
set/map literal, it replaces it with a synthetic MapEntry object
pointing to an InvalidExpression.  If there is no non-synthetic
MapEntry in the set/map, and it is decided to disambiguate to a set,
then all of the entries are fed into the `convertToElement` method.
Before this CL, this method would see the synthetic MapEntry and
assume the user had explicitly written a key-value pair in a set
literal, so it would try to report the error `Expected ',' before
this` at the location of the `:` in the key-value pair.  But since the
MapEntry was synthetic, there was no `:` and the message was very
confusing.

This CL changes `convertToElement` so that it detects when a MapEntry
has arisen from an error, and avoids creating a follow-on error.

Fixes #45174.

Bug: https://github.com/dart-lang/sdk/issues/45174
Change-Id: I37dc82a130b4bf858b3fb7411bb9c64f7450bd16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188940
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-03-04 15:52:57 +00:00
..
await_test.dart
bind_test.dart
const_error_test.dart
const_test.dart Reland "Flow analysis: promote to non-nullable on initialization" 2020-10-07 13:14:55 +00:00
helper_classes.dart
inference_test.dart
issue_45174_error_test.dart Front end: Fix follow-on error arising from ill-typed spread element. 2021-03-04 15:52:57 +00:00
map_set_ambiguity_error_test.dart
map_set_ambiguity_test.dart
null_spread_test.dart [test_runner] Support detection of CFE warnings 2020-09-15 07:57:31 +00:00
runtime_error_test.dart
spread_test.dart Reland "Flow analysis: promote to non-nullable on initialization" 2020-10-07 13:14:55 +00:00
syntax_error_test.dart
syntax_test.dart Reland "Flow analysis: promote to non-nullable on initialization" 2020-10-07 13:14:55 +00:00
type_error_test.dart Correct tests with unintended syntax errors 2020-09-22 06:59:43 +00:00
unevaluated_test.dart