Skip to content

Fix a case of MT reduction using abstract types #18243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ class TypeComparer(@constructorOnly initctx: Context) extends ConstraintHandling
tp1.cases.corresponds(tp2.cases)(isSubType)
case _ => false
}
(!caseLambda.exists || canWidenAbstract) && recur(tp1.underlying, tp2) || compareMatch
recur(tp1.underlying, tp2) || compareMatch
case tp1: AnnotatedType if tp1.isRefining =>
isNewSubType(tp1.parent)
case JavaArrayType(elem1) =>
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 @@ -53,6 +53,7 @@ i15827.scala
i17149.scala
tuple-fold.scala
mt-redux-norm.perspective.scala
i18202.scala

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

type TupleIndex[T <: Tuple, A, I <: Int] <: (Any, Int) = T match
case A *: _ => (A, I)
case _ *: t => TupleIndex[t, A, S[I]]

def tupleIndex[T <: Tuple, A](using i: ValueOf[Tuple.Elem[TupleIndex[T, A, 0], 1]]): Int = i.value