Skip to content

Commit eadd934

Browse files
committed
Method calls get a line number
1 parent f7ba81c commit eadd934

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
866866
defn.ObjectClass
867867
} else qualSym
868868
}
869+
lineNumber(app)
869870
generatedType = genCallMethod(sym, invokeStyle, app.span, receiverClass)
870871
}
871872
}

tests/run/apply-line.check

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Test$.void(apply-line.scala:4)
2+
Test$.test(apply-line.scala:10)
3+
Test$.main(apply-line.scala:14)
4+
Test.main(apply-line.scala)

tests/run/apply-line.scala

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
object Test:
3+
4+
def void(): Unit = ???
5+
def self(): this.type = this
6+
7+
def test(): Unit =
8+
this // is line 8
9+
.self()
10+
.void()
11+
12+
@annotation.nowarn
13+
def main(args: Array[String]): Unit =
14+
try test()
15+
catch (t: Throwable) => println(t.getStackTrace.iterator.filter(_.getFileName == "apply-line.scala").mkString("\n"))
16+
17+
/* was
18+
Test$.void(apply-line.scala:4)
19+
Test$.test(apply-line.scala:8)
20+
Test$.main(apply-line.scala:14)
21+
Test.main(apply-line.scala)
22+
*/

0 commit comments

Comments
 (0)