Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front end produces bogus "Expected ','" message for type mismatch in spread collection #45174

Closed
stereotype441 opened this issue Mar 3, 2021 · 0 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@stereotype441
Copy link
Member

stereotype441 commented Mar 3, 2021

The following code:

f(Object? objectQuestion) {
  return {...<int>{}, ...objectQuestion};
}

main() {}

produces these errors from the front end:

tests/language/spread_collections/issue_qqq_error_test.dart:6:26: Error: Unexpected type 'Object?' of a map spread entry.  Expected 'dynamic' or a Map.
 - 'Object' is from 'dart:core'.
  return {...<int>{}, ...objectQuestion};
                         ^
tests/language/spread_collections/issue_qqq_error_test.dart:6:26: Error: Expected ',' before this.
  return {...<int>{}, ...objectQuestion};
                         ^

The first message is ok (technically this is a set spread entry, not a map spread entry, but let's not fret about that right now). The second message is totally bogus.

This bug is blocking my work on "why not promoted" functionality (#44898), and I think I see how to fix it, so I'm going to go ahead and work on it now.

@stereotype441 stereotype441 added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Mar 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.
Projects
None yet
Development

No branches or pull requests

1 participant