-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DNM] [CS] Handle holes in mergeEquivalenceClasses
#83724
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
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please test |
@swift-ci please test source compatibility |
let x = foo([], i) | ||
// expected-error@-1 {{generic parameter 'T' could not be inferred}} | ||
// expected-error@-2 {{cannot convert value of type '[Any]' to expected argument type '_.Type'}} | ||
// FIXME: The above should say `T.Type` not `_.Type` ^ |
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.
I think this is a bug in FailureDiagnostic::resolveType
, might be easy to fix.
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.
Yeah the issue is that we need the hole's locator, but that currently requires iterating over the equivalence class, which we don't have in the Solution. So either we need to stick the locator on the type variable itself as an extra bit of state, or stick a mapping in the Solution
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.
Oh, I see.
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.
Should we just make that transformation part of ConstraintSystem::finalize
then?
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.
The actual type being diagnosed is part of the fix though, right? Unless I'm misunderstanding what you mean by transformation
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 never want to print type variables so maybe replacing them with an underlying generic parameter should be done as part of forming a solution instead of delaying it to diagnostics like we do right now.
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.
Ah right I see what you're saying, let me give that a try
No description provided.