Skip to content

crash when implementing varargs trait #25600

@DavidPerezIngeniero

Description

@DavidPerezIngeniero

Compiler version

3.3.6

Minimized code

trait T:
  @annotation.varargs
  def t(s: String, a: Any*): String

val x: T = (s, _) => s

Output (click arrow to expand)

 unhandled exception while running MegaPhase{crossVersionChecks, firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks} on rs$line$1

  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: rs$line$1
        during phase: MegaPhase{crossVersionChecks, firstTransform, checkReentrant, elimPackagePrefixes, cookComments, checkLoopingImplicits, betaReduce, inlineVals, expandSAMs, elimRepeated, refchecks}
                mode: Mode(ImplicitsEnabled,ReadPositions,Interactive)
     library version: version 2.13.16
    compiler version: version 3.3.6
            settings: -Ycook-docs true -Yread-docs true -classpath /home/david/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala3-library_3/3.3.6/scala3-library_3-3.3.6.jar:/home/david/.cache/coursier/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.13.16/scala-library-2.13.16.jar -d <REPL compilation output>

Exception in thread "main" scala.MatchError: List(method t, method t) (of class scala.collection.immutable.$colon$colon)
        at dotty.tools.dotc.transform.ExpandSAMs.transformBlock(ExpandSAMs.scala:70)
        at dotty.tools.dotc.transform.MegaPhase.goBlock(MegaPhase.scala:765)
        at dotty.tools.dotc.transform.MegaPhase.goBlock(MegaPhase.scala:766)
        at dotty.tools.dotc.transform.MegaPhase.transformBlock(MegaPhase.scala:471)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:309)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.mapValDef$1(MegaPhase.scala:245)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:250)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:446)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:459)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:459)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:370)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:266)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:446)
        at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:459)
        at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:459)
        at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:390)
        at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:393)
        at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:448)
        at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:475)
        at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:487)
        at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:341)
        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:334)
        at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:337)
        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:1324)
        at dotty.tools.dotc.Run.runPhases$1(Run.scala:308)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:348)
        at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:357)
        at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:357)
        at dotty.tools.dotc.Run.compileUnits(Run.scala:267)
        at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:87)
        at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:337)
        at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:299)
        at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:202)
        at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:205)
        at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:239)
        at dotty.tools.repl.ReplDriver.runBody$$anonfun$1(ReplDriver.scala:213)
        at dotty.tools.runner.ScalaClassLoader$.asContext(ScalaClassLoader.scala:80)
        at dotty.tools.repl.ReplDriver.runBody(ReplDriver.scala:213)
        at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:205)
        at dotty.tools.repl.ReplDriver.tryRunning(ReplDriver.scala:142)
        at dotty.tools.repl.Main$.main(Main.scala:7)
        at dotty.tools.repl.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions