-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[CS] Consolidate placeholder handling logic into Solution::simplifyType
#84666
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
Conversation
@swift-ci please test |
@swift-ci please SourceKit stress test |
func f(_: Int...) {} | ||
let _ = [(1, 2, 3)].map(f) // expected-error {{no exact matches in call to instance method 'map'}} | ||
// expected-note@-1 {{found candidate with type '(((Int, Int, Int)) -> _) -> Array<_>'}} | ||
// expected-note@-1 2{{found candidate with type '(((Int, Int, Int)) -> T) -> [T]'}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now get 2 notes here because T
is a generic parameter from 2 different decls. We ought to be able to fix this by canonicalizing ErrorType's original type when computing the canonical type, I can look into that in a follow-up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Make sure we do this after we transform the type as otherwise we could skip resolving type variables and let them escape.
Move the logic from `FailureDiagnostic::resolveType` into `Solution::simplifyType` to allow completion to use it too. While here, also handle cases where the placeholder is from a different member of the equivalence class to the generic parameter.
We ought to be able to just use `simplifyType` with an additional parameter to tell it to produce archetypes.
f249498
to
9e4208b
Compare
@swift-ci please smoke test |
@swift-ci please test Linux |
@swift-ci please smoke test Linux |
Move the logic from
FailureDiagnostic::resolveType
intoSolution::simplifyType
, which then allows us to re-use it insimplifyTypeForCodeCompletion
.