Skip to content

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

Merged
merged 4 commits into from
Jul 18, 2020

Conversation

eernstg
Copy link
Member

@eernstg eernstg commented Jul 9, 2020

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.

@eernstg eernstg requested a review from leafpetersen July 9, 2020 09:57
Copy link
Member

@leafpetersen leafpetersen left a 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?

@eernstg
Copy link
Member Author

eernstg commented Jul 17, 2020

Tests for null spreads are here.

@eernstg
Copy link
Member Author

eernstg commented Jul 17, 2020

Tightened the rule to cover ...?e/...e where e has types like Never and X extends Null as well.

@eernstg
Copy link
Member Author

eernstg commented Jul 17, 2020

@leafpetersen, do you maintain the approval with the changes of spread element typing?

@munificent
Copy link
Member

This LGTM too. Just to confirm, this aligns the spec with dart-lang/sdk#42304, right?

@eernstg
Copy link
Member Author

eernstg commented Jul 17, 2020

this aligns the spec with dart-lang/sdk#42304, right?

Yes, with Never rather than Null the situations in that issue are covered.

Copy link
Member

@leafpetersen leafpetersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@eernstg eernstg merged commit 5001616 into master Jul 18, 2020
@eernstg eernstg deleted the nnbd_spec_spread_combined_jul20 branch July 18, 2020 10:41
dart-bot pushed a commit to dart-lang/sdk that referenced this pull request Jul 20, 2020
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants