Exhaustivity: don't widen & then warn on singleton types#9209
Exhaustivity: don't widen & then warn on singleton types#9209lrytz merged 1 commit intoscala:2.13.xfrom
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
lrytz
left a comment
There was a problem hiding this comment.
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
| 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.
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.
Oh! Wow, yeah, good catch, thanks. Let's do that.
2fe421a to
e2a36e7
Compare
e2a36e7 to
1becce1
Compare
Fixes scala/bug#11603