Skip to content

Commit 74f65f9

Browse files
Fix #12278: Also tryNormalize LazyRefs
1 parent 48d0999 commit 74f65f9

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 fib3: Fib[3] = 2
10+
}

0 commit comments

Comments
 (0)