Skip to content

Transparent inline unapply causes compiler crash #17525

Closed
@reftrans

Description

@reftrans

Compiler version

Latest version, git commit 51d69e85e1f7c31459b57fe747a6d2ae7d1d3ab7, but the same problem exists in 3.0.0

Minimized code

object Extract {
  transparent inline def unapply(value: String): Option[Tuple] = Some((1, "two"))
}
def fail(): Unit = "" match { case Extract(a, b) => }

Output (click arrow to expand)

unhandled exception while running MegaPhase{protectedAccessors, extmethods, uncacheGivenAliases, elimByName, hoistSuperArgs, forwardDepChecks, specializeApplyMethods, tryCatchPatterns, patternMatcher} on extractor.scala

  An unhandled exception was thrown in the compiler.
  Please file a crash report here:
  https://github.com/lampepfl/dotty/issues/new/choose

     while compiling: <no file>
        during phase: <no phase>
                mode: Mode(ImplicitsEnabled)
     library version: version 2.13.10
    compiler version: version 3.3.1-RC1-bin-SNAPSHOT-git-51d69e8
            settings: 

                tree: EmptyTree
       tree position: :<unknown>
           tree type: <notype>
              symbol: val <none>
           call site: �[33mpackage�[0m �[35m<root>�[0m in module class <root>

  == Source file context for tree position ==


Exception in thread "main" scala.MatchError: List() (of class scala.collection.immutable.Nil$)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPatternPlan$1(PatternMatcher.scala:267)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsComponentsPlan$1(PatternMatcher.scala:262)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchArgsPlan$1(PatternMatcher.scala:273)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.$anonfun$12(PatternMatcher.scala:381)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:114)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$1$$anonfun$1(PatternMatcher.scala:381)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:114)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.unapplyPlan$1(PatternMatcher.scala:385)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.patternPlan(PatternMatcher.scala:422)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.caseDefPlan(PatternMatcher.scala:458)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan$$anonfun$1$$anonfun$1(PatternMatcher.scala:465)
	at scala.collection.immutable.List.foldRight(List.scala:352)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan$$anonfun$1(PatternMatcher.scala:465)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.letAbstract(PatternMatcher.scala:114)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.matchPlan(PatternMatcher.scala:466)
	at dotty.tools.dotc.transform.PatternMatcher$Translator.translateMatch(PatternMatcher.scala:1052)
	at dotty.tools.dotc.transform.PatternMatcher.transformMatch(PatternMatcher.scala:48)
	at dotty.tools.dotc.transform.MegaPhase.goMatch(MegaPhase.scala:804)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:371)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.mapDefDef$1(MegaPhase.scala:253)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:256)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:440)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:453)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:453)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:364)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:260)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:440)
	at dotty.tools.dotc.transform.MegaPhase.loop$1(MegaPhase.scala:453)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:453)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:384)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:387)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:442)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:469)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:481)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:327)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:331)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:246)
	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:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:262)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:270)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:279)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:67)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:279)
	at dotty.tools.dotc.Run.compileSources(Run.scala:194)
	at dotty.tools.dotc.Run.compile(Run.scala:179)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:37)
	at dotty.tools.dotc.Driver.process(Driver.scala:197)
	at dotty.tools.dotc.Driver.process(Driver.scala:165)
	at dotty.tools.dotc.Driver.process(Driver.scala:177)
	at dotty.tools.dotc.Driver.main(Driver.scala:207)
	at dotty.tools.MainGenericCompiler$.run$1(MainGenericCompiler.scala:162)
	at dotty.tools.MainGenericCompiler$.main(MainGenericCompiler.scala:186)
	at dotty.tools.MainGenericCompiler.main(MainGenericCompiler.scala)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions