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

Account for typedef nullability #257

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

srujzs
Copy link
Contributor

@srujzs srujzs commented Jun 17, 2024

_desugarTypedef accepts a _RawType and returns its underlying type if it's a typedef. However, it doesn't account for whether the _RawType is nullable or not. In order to accurately desugar a use of a typedef, we should union the _RawType's nullability with the underlying type's nullability. For example, SomeTypedef? should always be nullable after being desugared.

_desugarTypedef accepts a _RawType and returns its
underlying type if it's a typedef. However, it doesn't
account for whether the _RawType is nullable or not.
In order to accurately desugar a use of a typedef, we
should union the _RawType's nullability with the underlying
type's nullability. For example, `SomeTypedef?` should
always be nullable after being desugared.
@srujzs srujzs requested a review from sigmundch June 17, 2024 23:56
Copy link
Member

@sigmundch sigmundch left a comment

Choose a reason for hiding this comment

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

(consider also a CHANGELOG entry to indicate why some APIs are changing. Seems that all changes were in contravariant positions, so the change appears non-breaking?)

@srujzs
Copy link
Contributor Author

srujzs commented Jun 18, 2024

It is indeed non-breaking. Done, thanks!

@srujzs srujzs merged commit 6b8a465 into dart-lang:main Jun 18, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants