-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Update availability diagnostic for macOS major version number changes #40307
base: main
Are you sure you want to change the base?
Update availability diagnostic for macOS major version number changes #40307
Conversation
I moved the "narrow nearby version check" fix-it from the So the error is something like
and before, the accompanying fix-it was like
The suggested fix-it was rather cryptic, because there was no information to the user why this was suggested, and it was even unclear what it would do, because the change would almost always be in a different line than the error. Now, the fix-it will appear as a separate note. This way, it can have its own (hopefully more helpful) description. I have chosen the following:
This fix-it will now also co-exist with the usual fix-it options, like "add 'if #available' version check" and "add @available attribute to enclosing global function". Personally, I don't see a very good reason why the "narrowing" option should replace the usual options. I do see two exceptions though:
I would be happy to implement this (maybe by adding it to this PR, or in a next PR), but to do so, I will need to find out how to check whether the current statement is the only one inside its "version check context". If somebody could give me a hint about that, I would appreciate it. |
0c08372
to
0c6ad93
Compare
Rebased to fix conflicts. |
@DougGregor Hi! Excuse me for |
0c6ad93
to
e1e1ed8
Compare
e1e1ed8
to
bfa6423
Compare
bfa6423
to
3ceecd4
Compare
I would suggest that this PR would be easier to review if you narrowly restricted it to fixing the linked issue. Changing how the diagnostics are emitted is a rather separate concern and I can imagine there could be objections regarding the approach here of adjusting only this specific diagnostic and emitting an additional note on the basis of UI concerns that aren't unique to this diagnostic. |
3ceecd4
to
afd1e7b
Compare
@xwu Done! |
Resolves: #57419
From the description of the Swift Report in question:
So that's what I did 🙂