-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CS] Use fixes to diagnose instance member on type (or vice versa) access #21830
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
Great! I will take a closer look later today but one thing I see right away - please remove relevant code from CSDiag.cpp which is now obsolete. |
Oh yeah, done :) I am not sure about this block of code: https://github.com/apple/swift/blob/master/lib/Sema/CSDiag.cpp#L1006L1022 I've left it as it's a special case, but perhaps I can move it to |
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.
Overall I think this is very good start, but definitely needs more work...
Thanks a lot for the feedback @xedin! Can you take a look 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.
I think this is looking much better, almost there!
Build failed |
@xedin Seems like the filter approach isn't going to work as there's 7 test failures :( |
@theblixguy Looks like most of the diagnostics are improvements like:
The rest are related to |
Build failed |
@xedin Oh! I have updated those diagnostic messages to the improved one. I'll fix the |
@xedin I have removed the
So, dumping the CS makes it clear that the fix is created (actually twice):
but again, it's not getting diagnosed (i.e. nothing is called diagnoseAsError() on the fix) and we end up calling |
It looks like it might be producing ambiguous solution judging by two solutions you mentioned but it seemingly happening during expression diagnostics, because there is only one type variable which for regular call is too few. I'll checkout your code and try to run it to see what is going on. |
Ah I see, this label problem does not get diagnosed via fix, that's why it complains about it first, once that's fixed there is going to be Let me see if I can fix that to get label problem diagnosed via fix so we can get both diagnostics at the same time. |
@theblixguy I've opened #22797 to address this problem. Found one more simplication last moment, re-running tests locally to see if it works, and then I'm going to run tests on that PR. |
@xedin Great! Once your PR gets merged, I'll add the label diagnostic to that test case, run tests & and push my changes. Hopefully this will be the last one🤞 |
Sounds like a plan! :) |
@xedin I have updated the test diagnostic - ran tests locally and everything passes 🎉 |
@swift-ci please test |
@swift-ci please test source compatibility |
Build failed |
Build failed |
All tests have passed @xedin 🎉 🎉 🎉 |
Great! @theblixguy I'm going to squash everything together before merging if you don't mind? A lot of commit in the branch are merge commits and indentation changes. |
No problem @xedin! |
Thanks again for sticking with this @theblixguy! |
No problem, thanks a lot for your guidance and help as well @xedin :) |
This PR migrates instance member on type and type member on instance diagnostics handling to use the new diagnostics framework (fixes) and create more reliable and accurate diagnostics in such scenarios.