Skip to content

[Diagnostics] Special case assignment between nominal types with optional promotion #35072

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 2 commits into from
Dec 14, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 12, 2020

Skip fixing situation where source and destination of assignment are both
nominal types with different optionality until restriction is attempted.

Otherwise fix could be too greedy and diagnose valid code if all of the
types are known in advance.

Resolves: SR-13951
Resolves: rdar://problem/72166791

@xedin
Copy link
Contributor Author

xedin commented Dec 12, 2020

@swift-ci please smoke test

…onal promotion

Skip fixing situation where source and destination of assignment are both
nominal types with different optionality until restriction is attempted.

Otherwise fix could be too greedy and diagnose valid code if all of the
types are known in advance.

Resolves: SR-13951
Resolves: rdar://problem/72166791
@xedin
Copy link
Contributor Author

xedin commented Dec 12, 2020

@swift-ci please smoke test

Copy link
Member

@hborla hborla left a comment

Choose a reason for hiding this comment

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

LGTM!

@xedin xedin merged commit c9ef005 into swiftlang:main Dec 14, 2020
xedin added a commit to xedin/swift that referenced this pull request Jan 7, 2021
…optional

This is a follow-up to swiftlang#35072.

Let's wait until both sides are equally optional before attempting
`.rawValue` fix, otherwise there is a risk that a valid code would
get diagnosed.

Extend test coverage of possible `.rawValue` situations to
contextual and argument positions to make sure that valid
code is accepted.

Resolves: SR-13951
xedin added a commit to xedin/swift that referenced this pull request Jan 7, 2021
…optional

This is a follow-up to swiftlang#35072.

Let's wait until both sides are equally optional before attempting
`.rawValue` fix, otherwise there is a risk that a valid code would
get diagnosed.

Extend test coverage of possible `.rawValue` situations to
contextual and argument positions to make sure that valid
code is accepted.

Resolves: SR-13951
(cherry picked from commit 2641554)
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.

3 participants