-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Do not generate Return nodes for throw expressions #5082
Do not generate Return nodes for throw expressions #5082
Conversation
Namely throw MatchError
831f9eb
to
f88c09b
Compare
@@ -839,7 +839,8 @@ object PatternMatcher { | |||
default | |||
} | |||
case ResultPlan(tree) => | |||
Return(tree, ref(resultLabel)) | |||
if (tree.symbol eq defn.throwMethod) tree // Namely MatchError |
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.
Don't you want to be more general and test something like tree.tpe <:< NothingTpe
instead?
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.
Sounds good
@@ -839,7 +839,7 @@ object PatternMatcher { | |||
default | |||
} | |||
case ResultPlan(tree) => | |||
if (tree.symbol eq defn.throwMethod) tree // Namely MatchError | |||
if (tree.tpe <:< defn.NothingType) tree // Namely MatchError |
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.
The comment is not accurate anymore. It should say "for example MatchError". Otherwise LGTM.
Reverting to the first version of scala#5082. Fixes scala#12976
Reverting to the first version of scala#5082. Fixes scala#12976
Namely throw MatchError.