Closed
Description
This variation of tests/pos/i8449.scala
:
import scala.compiletime.ops.int.*
object Test {
type Fib[N <: Int] <: Int = N match {
case 0 => 0
case 1 => 1
case Any => Fib[N - 1] + Fib[N - 2]
}
val fib2: Fib[2] = 1
}
Fails with:
-- [E007] Type Mismatch Error: tests/pos/i8449.scala:10:21 ---------------------
10 | val fib2: Fib[2] = 1
| ^
|Found: (1 : Int)
|Required: Test.Fib[(2 : Int) - (1 : Int)] + Test.Fib[(2 : Int) - (2 : Int)]
I think the bug comes from Types.simplified
which simplifies "one step" instead of reaching a fixed point.