Skip to content

Crash when compiling with a local version of cats-core #22216

Open
@q-ata

Description

@q-ata

Compiler version

3.6.4-RC1-bin-SNAPSHOT-nonbootstrapped-git-7573951

Minimized code

The crash occurs when adding a local version of cats-core 2.10.0 to classpath.

Steps:

  1. sbt publishLocal a copy of cats-core-2.10.0 for scala 3.
  2. sbt "scalac -classpath \"*.jar:/path/to/cats-core_3.jar\" crash1.scala"

Where crash1.scala is the following:

import cats.implicits._

object Test:
  val alpha: Option[List[Int]] =
    List(1, 2, 3).traverse[Option, Int] {
      case _ => None
    }

Output (click arrow to expand)

Exception in thread "main" java.lang.AssertionError: assertion failed: trait IntInstances has non-class parent: TypeRef(TermRef(TermRef(TermRef(ThisType(TypeRef(NoPrefix,module class <root>)),object cats),object kernel),instances),IntInstances)
        at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2007)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2012)
        at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1978)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1985)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2006)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2012)
        at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1978)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1985)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2006)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2012)
        at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)

  exception occurred while typechecking crash1.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/scala/scala3/issues/new/choose
  For non-enriched exceptions, compile with -Xno-enrich-error-messages.


     while compiling: crash1.scala
        during phase: typer
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.15
    compiler version: version 3.6.4-RC1-bin-SNAPSHOT-nonbootstrapped-git-7573951
            settings: -classpath *.jar:/[redacted]/cats-core_3.jar:/[redacted]/scala-library-2.13.15.jar:/[redacted]/scala3-library_3-3.6.4-RC1-bin-SNAPSHOT.jar -d /[redacted]/default-last-scalac-out.jar
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1978)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1985)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:2006)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:2012)
        at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:3001)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1978)
        at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClasses(SymDenotations.scala:1985)
        at dotty.tools.dotc.core.SymDenotations$SymDenotation.isNoInitsRealClass(SymDenotations.scala:800)
        at dotty.tools.dotc.ast.TypedTreeInfo.refPurity(TreeInfo.scala:640)
        at dotty.tools.dotc.ast.TypedTreeInfo.refPurity$(TreeInfo.scala:523)
        at dotty.tools.dotc.ast.tpd$.refPurity(tpd.scala:23)
        at dotty.tools.dotc.ast.TypedTreeInfo.exprPurity(TreeInfo.scala:564)
        at dotty.tools.dotc.ast.TypedTreeInfo.exprPurity$(TreeInfo.scala:523)
        at dotty.tools.dotc.ast.tpd$.exprPurity(tpd.scala:23)
        at dotty.tools.dotc.ast.TypedTreeInfo.isIdempotentExpr(TreeInfo.scala:606)
        at dotty.tools.dotc.ast.TypedTreeInfo.isIdempotentExpr$(TreeInfo.scala:523)
        at dotty.tools.dotc.ast.tpd$.isIdempotentExpr(tpd.scala:23)
        at dotty.tools.dotc.typer.Checking.checkLegalImportOrExportPath(Checking.scala:1048)
        at dotty.tools.dotc.typer.Checking.checkLegalImportPath(Checking.scala:1054)
        at dotty.tools.dotc.typer.Checking.checkLegalImportPath$(Checking.scala:922)
        at dotty.tools.dotc.typer.Typer.checkLegalImportPath(Typer.scala:151)
        at dotty.tools.dotc.typer.Typer.typedImport(Typer.scala:3287)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3530)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3602)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3683)
        at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3695)
        at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3751)
        at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3314)
        at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3551)
        at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3602)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3679)
        at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3683)
        at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3794)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:507)
        at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
        at dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
        at scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
        at scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
        at scala.collection.immutable.List.prependedAll(List.scala:152)
        at scala.collection.immutable.List$.from(List.scala:685)
        at scala.collection.immutable.List$.from(List.scala:682)
        at scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
        at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:383)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:395)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:395)
        at dotty.tools.dotc.Run.compileSources(Run.scala:282)
        at dotty.tools.dotc.Run.compile(Run.scala:267)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:201)
        at dotty.tools.dotc.Driver.process(Driver.scala:169)
        at dotty.tools.dotc.Driver.process(Driver.scala:181)
        at dotty.tools.dotc.Driver.main(Driver.scala:211)
        at dotty.tools.dotc.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions