Skip to content
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

Regression in katrix/perspective (stack overflow with match types) #16706

Closed
jchyb opened this issue Jan 16, 2023 · 1 comment · Fixed by #16708
Closed

Regression in katrix/perspective (stack overflow with match types) #16706

jchyb opened this issue Jan 16, 2023 · 1 comment · Fixed by #16708
Assignees
Labels
area:match-types itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@jchyb
Copy link
Contributor

jchyb commented Jan 16, 2023

Community-build

Compiler version

3.2.2-RC2 (but stopped compiling somewhere between 3.2.0 and 3.2.1)

Minimized code

import scala.deriving.Mirror
import scala.reflect.ClassTag

type TupleUnionLub[T <: Tuple, Lub, Acc <: Lub] <: Lub = T match {
  case (h & Lub) *: t => TupleUnionLub[t, Lub, Acc | h]
  case EmptyTuple     => Acc
}

transparent inline given derived[A](
    using m: Mirror.SumOf[A],
    idClassTag: ClassTag[TupleUnionLub[m.MirroredElemTypes, A, Nothing]]
): Unit = ()

sealed trait Foo
case class FooA(a: Int) extends Foo

val instance = derived[Foo]

Output (click arrow to expand)

Exception in thread "main" java.lang.StackOverflowError
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:17)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)
        at dotty.tools.dotc.core.Substituters$SubstBindingMap.apply(Substituters.scala:167)
        at dotty.tools.dotc.core.Types$TypeMap.mapOver(Types.scala:5674)
        at dotty.tools.dotc.core.Substituters$.subst(Substituters.scala:25)

Expected outcome

Should compile like it did in 3.2.0

@jchyb jchyb added itype:bug regression This worked in a previous version but doesn't anymore stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 16, 2023
@Kordyjan Kordyjan added area:match-types and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jan 16, 2023
@Kordyjan Kordyjan added this to the Future versions milestone Jan 16, 2023
@prolativ
Copy link
Contributor

Bisection seems to point to #15625

@odersky odersky self-assigned this Jan 16, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 17, 2023
The previous check, meant to address scala#15618, tested whether all alternatives
of a match type had the same class tag and only then permitted a classtag
for the match type. This was the wrong test. It did not work for recursive
match types, because it could lead to stack overflow for them. And it did
not take into account that match types could be reduced.

A better test is to simply declare that match types themselves don't have a stable
erasure, just like TypeBounds don't have a stable erasure. If we find an applied
type with a match type as definition, we proceed to its translucent superytype,
which will try a match type reduction. If that succeeds we produce the classtag
of the redux. If not, we end up with an unreduced matchtype and refuse to generate
a classtag for it.

Fixes scala#16706
Fixes scala#16707
odersky added a commit to dotty-staging/dotty that referenced this issue Jan 17, 2023
The previous check, meant to address scala#15618, tested whether all alternatives
of a match type had the same class tag and only then permitted a classtag
for the match type. This was the wrong test. It did not work for recursive
match types, because it could lead to stack overflow for them. And it did
not take into account that match types could be reduced.

A better test is to simply declare that match types themselves don't have a stable
erasure, just like TypeBounds don't have a stable erasure. If we find an applied
type with a match type as definition, we proceed to its translucent superytype,
which will try a match type reduction. If that succeeds we produce the classtag
of the redux. If not, we end up with an unreduced matchtype and refuse to generate
a classtag for it.

Fixes scala#16706
Fixes scala#16707
odersky added a commit that referenced this issue Jan 23, 2023
The previous check, meant to address #15618, tested whether all
alternatives of a match type had the same classtag and only then
permitted a classtag for the match type. This was the wrong test. It did
not work for recursive match types, because it could lead to stack
overflow for them. And it did not take into account that match types
could be reduced.

A better test is to simply declare that match types themselves don't
have a stable erasure, just like TypeBounds don't have a stable erasure.
If we find an applied type with a match type as definition, we proceed
to its translucent supertype, which will try a match type reduction. If
that succeeds we produce the classtag of the redux. If not, we end up
with an unreduced matchtype and refuse to generate a classtag for it.

Fixes #16706
Fixes #16707
@Kordyjan Kordyjan modified the milestones: 3.3.0 backports, 3.3.1 Aug 1, 2023
sjrd added a commit to sjrd/perspective that referenced this issue Aug 9, 2023
We cannot use 3.3.0 because of scala/scala3#16706
but that issue is fixed in the latest RCs for 3.3.1.
sjrd added a commit to sjrd/perspective that referenced this issue Sep 6, 2023
We cannot use 3.3.0 because of scala/scala3#16706
but that issue is fixed in 3.3.1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:match-types itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants