-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Sema] Do not diagnose contextual type mismatches for malformed key path expressions #33230
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
[Sema] Do not diagnose contextual type mismatches for malformed key path expressions #33230
Conversation
ca33bd4
to
d92891f
Compare
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.
If it's already determined and diagnosed that that key path expression is invalid why not just return Type()
while generating constraints for it and avoid running solver for invalid AST?
Humm, haven't thought about that ... makes sense, let's try that! Thanks, @xedin :) |
Seems like doing this, affects code completion in a way, I'm still looking into this and not familiar with code completion ... but seems like it needs to type check |
d92891f
to
2913ed0
Compare
@xedin So should we keep this approach, or maybe run the solver only if it is type checking for code completion using SuppressDiagnostics flag otherwise |
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.
If code completion relies on this behavior then, LGTM! :) Let's name that method {is, has}SingleInvalidComponent
though for clarify.
@LucianoPAlmeida before you merge please add one more test case like |
58221c9
to
4c21b75
Compare
Just added, together with a minor adjustments |
@swift-ci please smoke test |
@swift-ci Please smoke test Windows platform |
…iagnose from pre-check
4c21b75
to
d9294e8
Compare
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 good! Naming could use some more though.
7e5199f
to
db41dcf
Compare
@swift-ci Please smoke test |
@xedin Naming and comments fixed :) Just making sure if there's anything else or we could land this? |
|
This just skips contextual type diagnostic for malformed key path expressions, because this leads at the very least, extra not good diagnostics. What do you think?