-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Prefer witnesses with no difference effects to ones that have fewer effects #40088
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
DougGregor
merged 1 commit into
swiftlang:main
from
DougGregor:async-witness-matching-resolution
Nov 9, 2021
Merged
Prefer witnesses with no difference effects to ones that have fewer effects #40088
DougGregor
merged 1 commit into
swiftlang:main
from
DougGregor:async-witness-matching-resolution
Nov 9, 2021
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@swift-ci please smoke test |
…ffects. One can overload on async vs. non-async, and the constraint solver has a preference rule based on context. Extend that preference rule to witness matching, so we prefer a witness that exactly matches the effects of the requirement to one that has fewer effects. Fixes rdar://84034057.
3f2a9a5
to
293e316
Compare
@swift-ci please smoke test |
kavon
added a commit
to kavon/swift
that referenced
this pull request
May 10, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
1 task
kavon
added a commit
to kavon/swift
that referenced
this pull request
May 11, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
kavon
added a commit
to kavon/swift
that referenced
this pull request
May 11, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
kavon
added a commit
to kavon/swift
that referenced
this pull request
May 12, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
meg-gupta
pushed a commit
to meg-gupta/swift
that referenced
this pull request
May 22, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
NuriAmari
pushed a commit
to NuriAmari/swift
that referenced
this pull request
May 28, 2023
You can overload a function based on its `async`-ness, and resolution is carried out based on async-ness of calling context. But during protocol conformance checking, for an `async` requirement we were accidentally choosing the non-`async overload instead of the `async` one. The `async` one is the choice people would expect, since the `async` requirement is in essence the "context" that forwards to the underlying witness. This intended behavior is also inferred from: swiftlang#40088 The problem boiled down to a bad check when categorizing the witness matches prior to ranking them. Resolves rdar://109135488 / swiftlang#60318
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One can overload on async vs. non-async, and the constraint solver has a
preference rule based on context. Extend that preference rule to
witness matching, so we prefer a witness that exactly matches the
effects of the requirement to one that has fewer effects.
Fixes rdar://84034057.