Skip to content

AssertionError: Failure to join alternatives #19789

Closed
@ivan-klass

Description

@ivan-klass

Compiler version

3.4.0, 3.3.2 or 3.3.3 raise the same error

Minimized code

type Kinded[F[_]] = F[Any] | F[Nothing]

def values[F[_]]: Vector[Kinded[F]] = ???

def mapValues[F[_], T](f: Kinded[F] => T): Vector[T] = values[F].map { case x => f(x) }
Error details
exception while retyping def $anonfun(x$1: Kinded[F]): T =
  matchResult1[T]: 
    {
      case val x1: (x$1 : Kinded[F]) = x$1
      case val x: Kinded[F] = x1
      return[matchResult1]
        {
          f.apply(x)
        }
    } of class DefDef # -1
Stack trace
java.lang.AssertionError: Failure to join alternatives F and F
	at dotty.tools.dotc.core.TypeOps$.fail$1(TypeOps.scala:253)
	at dotty.tools.dotc.core.TypeOps$.mergeRefinedOrApplied$1(TypeOps.scala:283)
	at dotty.tools.dotc.core.TypeOps$.mergeRefinedOrApplied$1(TypeOps.scala:271)
	at dotty.tools.dotc.core.TypeOps$.orDominator(TypeOps.scala:393)
	at dotty.tools.dotc.core.Types$OrType.join(Types.scala:3546)
	at dotty.tools.dotc.core.Types$Type.classSymbol(Types.scala:579)
	at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$apply(TypeErasure.scala:641)
	at dotty.tools.dotc.core.TypeErasure.paramErasure$1(TypeErasure.scala:690)
	at dotty.tools.dotc.core.TypeErasure.$anonfun$1(TypeErasure.scala:698)
	at scala.collection.immutable.List.mapConserve(List.scala:472)
	at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$apply(TypeErasure.scala:698)
	at dotty.tools.dotc.core.TypeErasure.eraseInfo(TypeErasure.scala:817)
	at dotty.tools.dotc.core.TypeErasure$.transformInfo(TypeErasure.scala:273)
	at dotty.tools.dotc.transform.Erasure.transform(Erasure.scala:96)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.goForward$1(Denotations.scala:831)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.current(Denotations.scala:877)
	at dotty.tools.dotc.core.Types$NamedType.computeDenot(Types.scala:2467)
	at dotty.tools.dotc.core.Types$NamedType.denot(Types.scala:2430)
	at dotty.tools.dotc.ast.Trees$DenotingTree.denot(Trees.scala:258)
	at dotty.tools.dotc.ast.Trees$Tree.symbol(Trees.scala:147)
	at dotty.tools.dotc.typer.ReTyper.retrieveSym(ReTyper.scala:147)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3086)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3197)
	at dotty.tools.dotc.typer.ReTyper.typedUnadapted(ReTyper.scala:174)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3275)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3279)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions