Skip to content

[Diagnostics] Improve diagnostics for implicit (un)tupling. #28076

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

Merged
merged 1 commit into from
Feb 14, 2020
Merged

[Diagnostics] Improve diagnostics for implicit (un)tupling. #28076

merged 1 commit into from
Feb 14, 2020

Conversation

varungandhi-apple
Copy link
Contributor

Fixes rdar://problem/56436226.

@varungandhi-apple
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@beccadax beccadax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The additional notes and rewording of the one diagnostic help a little, but I don't think they go far enough. I've annotated some of the test cases with my opinions about how we should diagnose them.

@varungandhi-apple
Copy link
Contributor Author

@swift-ci please test

@varungandhi-apple
Copy link
Contributor Author

Ugh, got a bunch of whitespace changes from the rebase. Force-pushed to remove those.

@swift-ci please test

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

@varungandhi-apple
Copy link
Contributor Author

@swift-ci please test

@swift-ci

This comment has been minimized.

@swift-ci

This comment has been minimized.

@varungandhi-apple
Copy link
Contributor Author

@brentdax do the changes look good to you? I've added the fix-its for adding/deleting parens and tests for those.

"and trying to match that instead", ())
WARNING(found_one_pattern_for_several_associated_values,none,
"enum case '%0' has %1 associated values; matching them as a tuple "
"is deprecated", (StringRef, unsigned))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies if I've paged something out, but why is this the only one of the three diagnostics which states that doing this is deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the other two cases, we most likely have a fix-it that either adds or removes parens (for example, you can look at the test cases), so I felt that providing an additional "this is deprecated" was not so useful. I can add that though, it is not a big deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@brentdax what do you think of my response? Ok to not have the deprecated note because we are supplying fix-its? Or should I still add it?

@varungandhi-apple
Copy link
Contributor Author

@swift-ci please test

@varungandhi-apple
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 08d44ad328edce1355da7a37fb36e788d4c2b9d2

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 08d44ad328edce1355da7a37fb36e788d4c2b9d2

@varungandhi-apple
Copy link
Contributor Author

Merging for now. We can tweak the diagnostic later again if desired.

@varungandhi-apple varungandhi-apple merged commit d58bf54 into swiftlang:master Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants