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
Exhaustivity: don't widen & then warn on singleton types #9209
Exhaustivity: don't widen & then warn on singleton types #9209
Conversation
An ambitious attempt at "just" shuffling some widen's around... but it didn't seem to produce unwanted effects after a quick |
ac63c93
to
13e3b96
Compare
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.
Not so easy for me to really review as I barely know anything about the patamat implementation. Generally it looks fine, the check file updates look OK. The setInfo
down in emitSwitch
is a little suspicious.
src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala
Outdated
Show resolved
Hide resolved
1c93b0e
to
2fe421a
Compare
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.
Very nice!
val Match(Typed(selTree: Ident, _), cases) = sw | ||
val sel = selTree.symbol | ||
val Match(Typed(selTree, _), cases) = sw | ||
val selArg = selTree match { |
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.
I'm not sure if this should be a def
to avoid structural sharing in the AST. Since trees have mutable fields (.tpe
, .pos
) this might be a problem - I'm really not sure if it matters in practice. @retronym what's your intuition?
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.
Oh! Wow, yeah, good catch, thanks. Let's do that.
2fe421a
to
e2a36e7
Compare
e2a36e7
to
1becce1
Compare
Fixes scala/bug#11603