mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 14:32:24 +00:00
219fe27e3e
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> |
||
---|---|---|
.. | ||
await_test.dart | ||
bind_test.dart | ||
const_error_test.dart | ||
const_test.dart | ||
helper_classes.dart | ||
inference_test.dart | ||
issue_45174_error_test.dart | ||
map_set_ambiguity_error_test.dart | ||
map_set_ambiguity_test.dart | ||
null_spread_test.dart | ||
runtime_error_test.dart | ||
spread_test.dart | ||
syntax_error_test.dart | ||
syntax_test.dart | ||
type_error_test.dart | ||
unevaluated_test.dart |