-
Notifications
You must be signed in to change notification settings - Fork 217
Spec null-safety combined member signature and spread type #1079
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks. Do we have tests covering the spread case?
Tests for null spreads are here. |
Tightened the rule to cover |
…null, `...` with `Never`
@leafpetersen, do you maintain the approval with the changes of spread element typing? |
This LGTM too. Just to confirm, this aligns the spec with dart-lang/sdk#42304, right? |
Yes, with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
A spread element in a collection literal, e.g., `[...e]` or `{...?e}`, can have an `e` of type `Null` or a subtype thereof. This CL adds a test where this situation is created for different types (`Null`, `Never`, `X extends Null`) with different collection literals, and with and without elements of other types. In general, the spread does not contribute any elements, and hence the element/key/value type is `Never` such that it has no effect on the element/key/value type of the collection. Cf. dart-lang/language#1079. Change-Id: Ib760bcba18045b1afaa50f65c0e7d0a7fe9a8ab6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154693 Commit-Queue: Erik Ernst <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
To maintain the result of discussions: This PR adds a specification of how to compute the combined member signature with null-safety, and how to compute various associated types for a
<spreadElement>
with null-safety.