Skip to content

Commit 84307b4

Browse files
tryCompiletimeConstantFold in disjointnessBoundary
Fixes #20166
1 parent bfc8a0d commit 84307b4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

compiler/src/dotty/tools/dotc/core/TypeComparer.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2902,6 +2902,8 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
29022902
tp
29032903
case tp: ConstantType =>
29042904
tp
2905+
case tp: AppliedType if tp.tryCompiletimeConstantFold.exists =>
2906+
tp.tryCompiletimeConstantFold
29052907
case tp: HKTypeLambda =>
29062908
tp
29072909
case tp: ParamRef =>

tests/pos/i20166.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import scala.compiletime.ops.int.+
2+
3+
type M[I <: Int] = 0 match
4+
case 1 + 1 => "a"
5+
case I + 1 => "b"
6+
case _ => "c"
7+
8+
val _: M[1] = "c"
9+
10+
11+
type M2[I <: Int, P] = I match
12+
case P => "b"
13+
case _ => "c"
14+
15+
val _: M2[5, 2 + 3] = "b"

0 commit comments

Comments
 (0)