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

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

Open
q-ata opened this issue Dec 16, 2024 · 0 comments
Open

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

q-ata opened this issue Dec 16, 2024 · 0 comments

Comments

@q-ata
Copy link
Contributor

q-ata commented Dec 16, 2024

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)
@q-ata q-ata added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 16, 2024
@Gedochao Gedochao added area:typer stat:needs minimization Needs a self contained minimization and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants