Skip to content

Commit 96999a0

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 96999a0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

+1-1
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) =>

tests/pos/i18202.scala

+7
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)