Skip to content

Conversation

@nicolasstucki
Copy link
Contributor

Namely throw MatchError.

@nicolasstucki nicolasstucki force-pushed the small-pattern-match-optimization branch from 831f9eb to f88c09b Compare September 5, 2018 13:39
@nicolasstucki nicolasstucki requested a review from sjrd September 5, 2018 13:39
}
case ResultPlan(tree) =>
Return(tree, ref(resultLabel))
if (tree.symbol eq defn.throwMethod) tree // Namely MatchError
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good

@nicolasstucki nicolasstucki self-assigned this Sep 5, 2018
}
case ResultPlan(tree) =>
if (tree.symbol eq defn.throwMethod) tree // Namely MatchError
if (tree.tpe <:< defn.NothingType) tree // Namely MatchError
Copy link
Member

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.

@nicolasstucki nicolasstucki merged commit eda6b0c into scala:master Sep 5, 2018
@nicolasstucki nicolasstucki deleted the small-pattern-match-optimization branch September 5, 2018 15:27
odersky added a commit to dotty-staging/dotty that referenced this pull request Jun 29, 2021
BarkingBad pushed a commit to BarkingBad/dotty that referenced this pull request Jul 23, 2021
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.

2 participants