Skip to content

Crash with inline accessor for implicit functions #5295

Closed
@nicolasstucki

Description

@nicolasstucki
inline def foo: String = bar given (4)
private def bar: given Int => String = "baz"

crashes with

checking tests/run/tasty-getfile/Macro_1.scala after phase MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments}
result of tests/run/tasty-getfile/Macro_1.scala after Ycheck:
  Unchanged since MegaPhase{firstTransform, checkReentrant, elimPackagePrefixes, cookComments}
exception occurred while compiling tests/run/tasty-getfile/Macro_1.scala
Exception in thread "main" scala.MatchError: Ident(bar) (of class dotty.tools.dotc.ast.Trees$Ident)
	at dotty.tools.dotc.transform.ShortcutImplicits.splitClosure$1(ShortcutImplicits.scala:115)
	at dotty.tools.dotc.transform.ShortcutImplicits.transformDefDef(ShortcutImplicits.scala:136)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:941)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:942)
	at dotty.tools.dotc.transform.MegaPhase.goDefDef(MegaPhase.scala:942)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:248)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$transformStats$2(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:179)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:339)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformNamed$1(MegaPhase.scala:251)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:394)
	at dotty.tools.dotc.transform.MegaPhase.transformStat$1(MegaPhase.scala:404)
	at dotty.tools.dotc.transform.MegaPhase.$anonfun$transformStats$2(MegaPhase.scala:409)
	at scala.collection.immutable.List.mapConserve(List.scala:179)
	at dotty.tools.dotc.transform.MegaPhase.transformStats(MegaPhase.scala:409)
	at dotty.tools.dotc.transform.MegaPhase.mapPackage$1(MegaPhase.scala:356)
	at dotty.tools.dotc.transform.MegaPhase.transformUnnamed$1(MegaPhase.scala:359)
	at dotty.tools.dotc.transform.MegaPhase.transformTree(MegaPhase.scala:396)
	at dotty.tools.dotc.transform.MegaPhase.transformUnit(MegaPhase.scala:415)
	at dotty.tools.dotc.transform.MegaPhase.run(MegaPhase.scala:427)
	at dotty.tools.dotc.core.Phases$Phase.$anonfun$runOn$1(Phases.scala:316)
	at scala.collection.immutable.List.map(List.scala:286)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:314)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$3(Run.scala:158)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at dotty.tools.dotc.util.Stats$.trackTime(Stats.scala:49)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2(Run.scala:155)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$2$adapted(Run.scala:153)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:36)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:198)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:153)
	at dotty.tools.dotc.Run.$anonfun$compileUnits$1(Run.scala:178)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:102)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:133)
	at dotty.tools.dotc.Run.compileSources(Run.scala:120)
	at dotty.tools.dotc.Run.compile(Run.scala:104)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:33)
	at dotty.tools.dotc.Driver.process(Driver.scala:170)
	at dotty.tools.dotc.Driver.process(Driver.scala:139)
	at dotty.tools.dotc.Driver.process(Driver.scala:151)
	at dotty.tools.dotc.Driver.main(Driver.scala:178)
	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