Skip to content

Commit 705e50d

Browse files
committed
Fix bootstrap: pass null explicitly as run-time
1 parent 4687bab commit 705e50d

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

compiler/src/dotty/tools/dotc/util/SourcePosition.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ extends interfaces.SourcePosition with Showable {
7070
}
7171

7272
/** A sentinel for a non-existing source position */
73-
@sharable object NoSourcePosition extends SourcePosition(NoSource, NoSpan) {
73+
@sharable object NoSourcePosition extends SourcePosition(NoSource, NoSpan, null) {
7474
override def toString: String = "?"
7575
override def withOuter(outer: SourcePosition): SourcePosition = outer
7676
}

tests/neg/i4659b.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
case class SourcePosition(outer: SourcePosition = NoSourcePosition) {
2+
assert(outer != null) // crash
3+
}
4+
5+
object NoSourcePosition extends SourcePosition() // error

tests/run/i4659b.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
case class SourcePosition(outer: SourcePosition = (NoSourcePosition: SourcePosition))
2+
3+
object NoSourcePosition extends SourcePosition()
4+
5+
object Test extends App {
6+
assert(NoSourcePosition.outer == null)
7+
}

0 commit comments

Comments
 (0)