Compiler version
3.8.3-RC3
Minimized code
The following piece of code crashes the REPL:
object Fuzz {
def f(x: Int): Unit =
println(x)
@inline def g[@inline x: _](y: x): Unit =
f(y)
def f(x: Int): Unit =
println(x)
def g[@inline x: _](y: x): Unit =
f(y)
}
It appears that this error case can be simplified into this single line:
def g[@inline x: _](y: x): Unit = ()
Given to the REPL, this produces an assertion error instead of a syntax error:
Exception in thread "main" java.lang.AssertionError: assertion failed: end of NoSpan
at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:10)
at dotty.tools.dotc.util.Spans$Span$.end$extension(Spans.scala:51)
at dotty.tools.dotc.parsing.Parsers$Parser.contextBound(Parsers.scala:2333)
...
at dotty.tools.repl.Main.main(Main.scala)
The bug occurs because _ is parsed as a placeholder type and receives NoSpan, while
contextBound() assumes that a tree always has a valid span.
Thanks to OSTIF/Quarkslab for finding this.
Compiler version
3.8.3-RC3
Minimized code
The following piece of code crashes the REPL:
It appears that this error case can be simplified into this single line:
Given to the REPL, this produces an assertion error instead of a syntax error:
The bug occurs because
_is parsed as a placeholder type and receives NoSpan, whilecontextBound()assumes that a tree always has a valid span.Thanks to OSTIF/Quarkslab for finding this.