Skip to content

crash when inlining inline param bound to val _ #9626

Closed
@bishabosha

Description

@bishabosha

Minimized code

scala> inline def scaffolding(limit: Int, label: String)(inline op: Unit): Unit =                                                                          
     |   var start = System.nanoTime
     |   var i = 0
     |   while i < limit do
     |     val _ = op // also prints warning here unless assigning to a value
     |     i += 1
     |   val end = System.nanoTime
     |   println(s"time to $label = ${BigDecimal(end-start) / BigDecimal(limit)}")
     | 
def scaffolding(limit: Int, label: String)(op: Unit @InlineParam): Unit

scala> scaffolding(10, "prinln(foo)") { println("foo") }
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value op$proxy1(line 0) when pickling rs$line$9
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:738)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$8$$anonfun$7(Pickler.scala:63)
	... // crash details below

Output (click arrow to expand)

scala> scaffolding(10, "prinln(foo)") { println("foo") }
Exception in thread "main" java.lang.AssertionError: assertion failed: unresolved symbols: value op$proxy1(line 0) when pickling rs$line$9
	at dotty.DottyPredef$.assertFail(DottyPredef.scala:17)
	at dotty.tools.dotc.core.tasty.TreePickler.pickle(TreePickler.scala:738)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$8$$anonfun$7(Pickler.scala:63)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run$$anonfun$1(Pickler.scala:87)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.transform.Pickler.run(Pickler.scala:87)
	at dotty.tools.dotc.core.Phases$Phase.runOn$$anonfun$1(Phases.scala:296)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.core.Phases$Phase.runOn(Phases.scala:297)
	at dotty.tools.dotc.transform.Pickler.runOn(Pickler.scala:91)
	at dotty.tools.dotc.Run.runPhases$4$$anonfun$4(Run.scala:180)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at dotty.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
	at dotty.tools.dotc.Run.runPhases$5(Run.scala:190)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:198)
	at dotty.runtime.function.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:64)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:205)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:147)
	at dotty.tools.repl.ReplCompiler.runCompilationUnit(ReplCompiler.scala:151)
	at dotty.tools.repl.ReplCompiler.compile(ReplCompiler.scala:161)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:233)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:196)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:129)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:132)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:151)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:132)
	at dotty.tools.repl.Main$.main(Main.scala:6)
	at dotty.tools.repl.Main.main(Main.scala)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions