Skip to content

[Diagnostics] Handle ambiguities related to use of nil literal #37178

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 3 commits into from
May 6, 2021

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 30, 2021

When nil is passed as an argument to call with multiple overloads
it's possible that this would result in ambiguity where matched
expected argument type doesn't conform to ExpressibleByNilLiteral.

To handle situations like this locator for contextual mismatch
has to be adjusted to point to the call where nil is used, so
diagnoseAmbiguityWithFixes can identify multiple overloads and
produce a correct ambiguity diagnostic.

Resolves: rdar://75514153

@xedin xedin requested a review from hborla April 30, 2021 18:43
@xedin
Copy link
Contributor Author

xedin commented May 3, 2021

@swift-ci please test macOS platform

@xedin
Copy link
Contributor Author

xedin commented May 3, 2021

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2021

Build failed
Swift Test Linux Platform
Git Sha - 0301e40fbdcbf1bae7e82e96d77fdeac57da0cd0

@xedin
Copy link
Contributor Author

xedin commented May 3, 2021

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented May 3, 2021

Build failed
Swift Test OS X Platform
Git Sha - 0301e40fbdcbf1bae7e82e96d77fdeac57da0cd0

xedin added 3 commits May 5, 2021 11:00
…rgument position

New note mentions both expected argument type and its position
and anchors to the affected overload choice.
When `nil` is passed as an argument to call with multiple overloads
it's possible that this would result in ambiguity where matched
expected argument type doesn't conform to `ExpressibleByNilLiteral`.

To handle situations like this locator for contextual mismatch
has to be adjusted to point to the call where `nil` is used, so
`diagnoseAmbiguityWithFixes` can identify multiple overloads and
produce a correct ambiguity diagnostic.

Resolves: rdar://75514153
@xedin xedin force-pushed the rdar-75514153 branch from 0301e40 to 29cb7dd Compare May 5, 2021 19:56
@xedin
Copy link
Contributor Author

xedin commented May 5, 2021

@swift-ci please test

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