Skip to content

Commit

Permalink
Method calls get a line number
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed May 7, 2023
1 parent f7ba81c commit aa7d19f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
defn.ObjectClass
} else qualSym
}
lineNumber(app)
generatedType = genCallMethod(sym, invokeStyle, app.span, receiverClass)
}
}
Expand Down
26 changes: 26 additions & 0 deletions tests/run/apply-line.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

object Test:

def void(): Unit = ???
def self(): this.type = this

def test(): Unit =
this // is line 8
.self()
.void()

@annotation.nowarn
def main(args: Array[String]): Unit =
try test()
catch (t: Throwable) =>
t.getStackTrace.iterator
.filter(_.getFileName == "apply-line.scala")
.filter(_.getMethodName == "test")
.foreach(sf => assert(sf.getLineNumber == 10))

/* was
Test$.void(apply-line.scala:4)
Test$.test(apply-line.scala:8)
Test$.main(apply-line.scala:14)
Test.main(apply-line.scala)
*/

0 comments on commit aa7d19f

Please sign in to comment.