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

AssertionError: Failure to join alternatives #19789

Closed
ivan-klass opened this issue Feb 26, 2024 · 1 comment · Fixed by #20090
Closed

AssertionError: Failure to join alternatives #19789

ivan-klass opened this issue Feb 26, 2024 · 1 comment · Fixed by #20090

Comments

@ivan-klass
Copy link

ivan-klass commented Feb 26, 2024

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)
@ivan-klass ivan-klass added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Feb 26, 2024
@Gedochao Gedochao added area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 12, 2024
@Gedochao
Copy link
Contributor

Still replicable on main (3694d95)

@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this issue Jul 5, 2024
…21056)

Backports #20090 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants