Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4171,7 +4171,7 @@ object Types {
case MatchAlias(alias) =>
trace(i"normalize $this", typr, show = true) {
MatchTypeTrace.recurseWith(this) {
alias.applyIfParameterized(args).tryNormalize
alias.applyIfParameterized(args.map(_.normalized)).tryNormalize
}
}
case _ =>
Expand Down
1 change: 1 addition & 0 deletions compiler/test/dotc/pos-test-pickling.blacklist
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ i9999.scala
9757.scala
9890.scala
13491.scala
7512.scala

# Opaque type
i5720.scala
Expand Down
24 changes: 24 additions & 0 deletions tests/pos/7512.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import scala.compiletime.ops.int.S

object InfiniteLoopMatchType {
def main(args: Array[String]): Unit = {
testProd(2, 10)
}

def testProd(a: Int, b: Int)(using ev: (a.type * b.type) =:= (b.type * a.type)) = true

type *[A <: Int, B <: Int] <: Int = A match {
case 0 => 0
case _ => MultiplyLoop[A, B, 0]
}

type MultiplyLoop[A <: Int, B <: Int, Acc <: Int] <: Int = A match {
case 0 => Acc
case S[aMinusOne] => MultiplyLoop[aMinusOne, B, B + Acc]
}

type +[A <: Int, B <: Int] <: Int = A match {
case 0 => B
case S[aMinusOne] => aMinusOne + S[B]
}
}