Skip to content

[CSRanking] Detect cases where overload choices are incomparable #29936

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 1 commit into from
Feb 20, 2020

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Feb 19, 2020

If constraint system is underconstrained e.g. because there are
editor placeholders, it's possible to end up with multiple solutions
where each ambiguous declaration is going to have its own overload kind:

func foo(_: Int) -> [Int] { ... }
func foo(_: Double) -> (result: String, count: Int) { ... }

_ = foo(<#arg#>).count

In this case solver would produce 2 solutions: one where count
is a property reference on [Int] and another one is tuple access
for a count: element.

Resolves: rdar://problem/49712598

If constraint system is underconstrained e.g. because there are
editor placeholders, it's possible to end up with multiple solutions
where each ambiguous declaration is going to have its own overload kind:

```swift
func foo(_: Int) -> [Int] { ... }
func foo(_: Double) -> (result: String, count: Int) { ... }

_ = foo(<#arg#>).count
```

In this case solver would produce 2 solutions: one where `count`
is a property reference on `[Int]` and another one is tuple access
for a `count:` element.

Resolves: rdar://problem/49712598
@xedin xedin requested review from hborla and nathawes February 19, 2020 22:13
@xedin
Copy link
Contributor Author

xedin commented Feb 19, 2020

@swift-ci please smoke test

Copy link
Contributor

@nathawes nathawes left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

@xedin
Copy link
Contributor Author

xedin commented Feb 20, 2020

@swift-ci please test source compatibility

@xedin xedin merged commit 88ca382 into swiftlang:master Feb 20, 2020
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