We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents eda6b0c + bfb716f commit 0c21d4cCopy full SHA for 0c21d4c
compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
@@ -117,7 +117,7 @@ object PatternMatcher {
117
/** Widen type as far as necessary so that it does not refer to a pattern-
118
* generated variable.
119
*/
120
- private def sanitize(tp: Type): Type = tp.widenExpr match {
+ private def sanitize(tp: Type): Type = tp.widenIfUnstable match {
121
case tp: TermRef if refersToInternal(false, tp) => sanitize(tp.underlying)
122
case tp => tp
123
}
tests/pos/i4999.scala
@@ -0,0 +1,9 @@
1
+trait Foo
2
+final class Bar extends Foo
3
+
4
+class Test {
5
+ def test(xs: => Foo) = xs match {
6
+ case xs: Bar => 1
7
+ case _ => 2
8
+ }
9
+}
0 commit comments