Skip to content

REPL: missing span with valid code and -Xprint:<some phase> #10883

Closed
@bishabosha

Description

@bishabosha

Minimized code

The following only crashes when using the REPL with the option -Xprint:typer:

object Foo {
  object Bar // must be an object
  export Bar._
}

Output (click arrow to expand)

scala> object Foo {                                                                                                         
     |   object Bar
     |   export Bar._
     | }
     | 
Exception in thread "main" java.lang.AssertionError: assertion failed
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:11)
	at dotty.tools.dotc.util.Spans$Span$.point$extension(Spans.scala:56)
	at dotty.tools.dotc.util.SourcePosition.point(SourcePosition.scala:26)
	at dotty.tools.dotc.util.SourcePosition.line(SourcePosition.scala:28)
	at dotty.tools.repl.ReplDriver.$anonfun$5(ReplDriver.scala:261)
	at scala.math.Ordering$$anon$1.compare(Ordering.scala:140)
	at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
	at java.util.TimSort.sort(TimSort.java:220)
	at java.util.Arrays.sort(Arrays.java:1438)
	at scala.collection.SeqOps.sorted(Seq.scala:700)
	at scala.collection.SeqOps.sorted$(Seq.scala:692)
	at scala.collection.immutable.List.scala$collection$immutable$StrictOptimizedSeqOps$$super$sorted(List.scala:79)
	at scala.collection.immutable.StrictOptimizedSeqOps.sorted(StrictOptimizedSeqOps.scala:78)
	at scala.collection.immutable.StrictOptimizedSeqOps.sorted$(StrictOptimizedSeqOps.scala:78)
	at scala.collection.immutable.List.sorted(List.scala:79)
	at dotty.tools.repl.ReplDriver.compile$$anonfun$2(ReplDriver.scala:264)
	at scala.util.Either.fold(Either.scala:189)
	at dotty.tools.repl.ReplDriver.compile(ReplDriver.scala:269)
	at dotty.tools.repl.ReplDriver.interpret(ReplDriver.scala:197)
	at dotty.tools.repl.ReplDriver.loop$1(ReplDriver.scala:130)
	at dotty.tools.repl.ReplDriver.runUntilQuit$$anonfun$1(ReplDriver.scala:133)
	at dotty.tools.repl.ReplDriver.withRedirectedOutput(ReplDriver.scala:152)
	at dotty.tools.repl.ReplDriver.runUntilQuit(ReplDriver.scala:133)
	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