Skip to content

Compiler crashes with a simple source containing inline - no path exists from trait F to <none> #20300

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

Closed
OndrejSpanel opened this issue Apr 30, 2024 · 0 comments · Fixed by #20313
Labels
itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label
Milestone

Comments

@OndrejSpanel
Copy link
Member

Compiler version

3.2.1 - 3.4.2-RC1

Note: This is 3.2.1 regression, the error does not happen with 3.0.0-3.2.0

Minimized code

trait T:

  def v() = ()

  trait F:
    def f(): Unit =
      inline def op(): Unit = v()
      op()

Output (click arrow to expand)

Exception in thread "main" java.lang.ClassCastException: no path exists from class F to
  unhandled exception while running MegaPhase{pruneErasedDefs, uninitialized, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, specializeTuples, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors} on inline-crash.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 -Yno-enrich-error-messages.

     while compiling: inline-crash.scala
        during phase: MegaPhase{pruneErasedDefs, uninitialized, inlinePatterns, vcInlineMethods, seqLiterals, intercepted, getters, specializeFunctions, specializeTuples, collectNullableFields, elimOuterSelect, resolveSuper, functionXXLForwarders, paramForwarding, genericTuples, letOverApply, arrayConstructors}
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.12
    compiler version: version 3.4.1
            settings:

Exception in thread "main" java.lang.ClassCastException: no path exists from trait F to  <none>
        at dotty.tools.dotc.transform.ExplicitOuter$OuterOps$.path$extension(ExplicitOuter.scala:485)
        at dotty.tools.dotc.transform.ElimOuterSelect.transformSelect(ElimOuterSelect.scala:31)
        at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:632)
        at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:633)
        at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:633)
        at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:633)
        at dotty.tools.dotc.transform.MegaPhase.goSelect(MegaPhase.scala:633)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:241)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:247)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:252)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.loop$3(MegaPhase.scala:482)
        at dotty.tools.dotc.transform.MegaPhase.transformTrees(MegaPhase.scala:482)
        at dotty.tools.dotc.transform.MegaPhase.transformSpecificTrees(MegaPhase.scala:485)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:406)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
        at dotty.tools.dotc.transform.MegaPhase.loop$2$$anonfun$1(MegaPhase.scala:470)
        at dotty.tools.dotc.transform.MegaPhase.loop$2(MegaPhase.scala:472)
        at dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:472)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:311)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
        at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:261)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:264)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:372)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:372)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:268)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:461)
        at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:392)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:395)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:450)
        at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:477)
        at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:489)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:354)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
        at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
        at scala.collection.immutable.List.foreach(List.scala:333)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:360)
        at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:315)
        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:337)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:350)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:360)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:360)
        at dotty.tools.dotc.Run.compileSources(Run.scala:261)
        at dotty.tools.dotc.Run.compile(Run.scala:246)
        at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
        at dotty.tools.dotc.Driver.process(Driver.scala:196)
        at dotty.tools.dotc.Driver.process(Driver.scala:164)
        at dotty.tools.dotc.Driver.process(Driver.scala:176)
        at dotty.tools.dotc.Driver.main(Driver.scala:206)
        at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
        at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
        at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at coursier.bootstrap.launcher.a.a(Unknown Source)
        at coursier.bootstrap.launcher.Launcher.main(Unknown Source)
@OndrejSpanel OndrejSpanel added itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 30, 2024
odersky added a commit to dotty-staging/dotty that referenced this issue May 1, 2024
odersky added a commit that referenced this issue May 6, 2024
WojciechMazur pushed a commit to WojciechMazur/dotty that referenced this issue May 6, 2024
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur pushed a commit that referenced this issue Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
itype:bug itype:crash stat:needs triage Every issue needs to have an "area" and "itype" label
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants