Skip to content
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

Don't crash on switch expressions or switch statements with arrow cases. #4976

Merged
merged 15 commits into from
Dec 6, 2021

Conversation

smillst
Copy link
Member

@smillst smillst commented Dec 3, 2021

I added an issue to track the remaining switch expressions todos: #4977.

Fixes #4911.

*/
public Node visitSwitchExpression17(Tree switchExpressionTree, Void p) {
// TODO: Analyze switch expressions properly.
return new MarkerNode(
Copy link
Member Author

Choose a reason for hiding this comment

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

I decided not to add a SwitchExpressionNode, because I wasn't sure what fields it would need when we properly implement switch expressions.

@msridhar
Copy link
Contributor

msridhar commented Dec 4, 2021

This change prevents crashes not only for switch expressions, but also for switch statements that use the new kind of "arrow" case labels, right?

@smillst
Copy link
Member Author

smillst commented Dec 6, 2021

@msridhar

This change prevents crashes not only for switch expressions, but also for switch statements that use the new kind of "arrow" case labels, right?

Yes. I'll update the change log, PR title to make this clear.

@smillst smillst changed the title Don't crash on switch expressions. Don't crash on switch expressions or switch statements with arrow cases. Dec 6, 2021
@mernst mernst merged commit 17dbf44 into typetools:master Dec 6, 2021
@mernst mernst deleted the switch-expressions-nocrash branch December 6, 2021 18:07
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.

Guide how to add Checker to existing huge code base.
3 participants