Skip to content

Commit 24e89fa

Browse files
Fix #12278: Also tryNormalize LazyRefs
1 parent 48d0999 commit 24e89fa

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2816,6 +2816,8 @@ object Types {
28162816
private var myRef: Type = null
28172817
private var computed = false
28182818

2819+
override def tryNormalize(using Context): Type = ref.tryNormalize
2820+
28192821
def ref(using Context): Type =
28202822
if computed then
28212823
if myRef == null then

tests/pos/12278.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import scala.compiletime.ops.int.*
2+
3+
object Test {
4+
type Fib[N <: Int] <: Int = N match {
5+
case 0 => 0
6+
case 1 => 1
7+
case Any => Fib[N - 1] + Fib[N - 2]
8+
}
9+
val fib0: Fib[0] = 0
10+
val fib1: Fib[1] = 1
11+
val fib2: Fib[2] = 1
12+
val fib3: Fib[3] = 2
13+
val fib4: Fib[4] = 3
14+
val fib5: Fib[5] = 5
15+
val fib6: Fib[6] = 8
16+
}

0 commit comments

Comments
 (0)