Skip to content

Commit 0e9b21a

Browse files
committed
Fix a case of MT reduction using abstract types
The original motivation wasn't with a test case. And reproducing it is not convincing. So I'd rather revert and fix this issue.
1 parent b7e797d commit 0e9b21a

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
10301030
tp1.cases.corresponds(tp2.cases)(isSubType)
10311031
case _ => false
10321032
}
1033-
(!caseLambda.exists || canWidenAbstract) && recur(tp1.underlying, tp2) || compareMatch
1033+
recur(tp1.underlying, tp2) || compareMatch
10341034
case tp1: AnnotatedType if tp1.isRefining =>
10351035
isNewSubType(tp1.parent)
10361036
case JavaArrayType(elem1) =>

compiler/test/dotc/pos-test-pickling.blacklist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ i15827.scala
5353
i17149.scala
5454
tuple-fold.scala
5555
mt-redux-norm.perspective.scala
56+
i18202.scala
5657

5758
# Opaque type
5859
i5720.scala

tests/pos/i18202.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import compiletime.ops.int.*
2+
3+
type TupleIndex[T <: Tuple, A, I <: Int] <: (Any, Int) = T match
4+
case A *: _ => (A, I)
5+
case _ *: t => TupleIndex[t, A, S[I]]
6+
7+
def tupleIndex[T <: Tuple, A](using i: ValueOf[Tuple.Elem[TupleIndex[T, A, 0], 1]]): Int = i.value

0 commit comments

Comments
 (0)