Skip to content

Commit bfb716f

Browse files
committed
Don't widen stable scrutinee types
Since ExprType are unstable, we can keep stable TermRef alone, in case this provides more info to the pattern matcher/exhaustivity checker.
1 parent 3cc4837 commit bfb716f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ object PatternMatcher {
116116
/** Widen type as far as necessary so that it does not refer to a pattern-
117117
* generated variable.
118118
*/
119-
private def sanitize(tp: Type): Type = tp.widenTermRefExpr match {
119+
private def sanitize(tp: Type): Type = tp.widenIfUnstable match {
120120
case tp: TermRef if refersToInternal(false, tp) => sanitize(tp.underlying)
121121
case tp => tp
122122
}

0 commit comments

Comments
 (0)