Skip to content

Commit

Permalink
Check if source exists for inline positions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasstucki committed Feb 7, 2022
1 parent e347416 commit 733af41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,12 @@ trait MessageRendering {
sb.append(EOL).append(newBox())
sb.append(EOL).append(offsetBox).append(i"Inline stack trace")
for inlinedPos <- inlineStack if inlinedPos != pos1 do
val (srcBefore, srcAfter, offset) = sourceLines(inlinedPos)
val marker = positionMarker(inlinedPos)
sb.append(EOL).append(newBox(soft = true))
sb.append(EOL).append(offsetBox).append(i"This location contains code that was inlined from $pos")
sb.append(EOL).append((srcBefore ::: marker :: srcAfter).mkString(EOL))
if inlinedPos.source.file.exists then
val (srcBefore, srcAfter, _) = sourceLines(inlinedPos)
val marker = positionMarker(inlinedPos)
sb.append(EOL).append((srcBefore ::: marker :: srcAfter).mkString(EOL))
sb.append(EOL).append(endBox)
}
else sb.append(msg.message)
Expand Down
1 change: 1 addition & 0 deletions project/scripts/cmdTests
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ cp tests/neg/i6371/B_2.scala $OUT/B.scala
"$SBT" "scalac $OUT/A.scala -d $OUT1"
rm $OUT/A.scala
"$SBT" "scalac -classpath $OUT1 -d $OUT1 $OUT/B.scala" > "$tmp" 2>&1 || echo "ok"
cat "$tmp" # for debugging
grep -qe "B.scala:2:7" "$tmp"
grep -qe "This location contains code that was inlined from A.scala:3" "$tmp"

Expand Down

0 comments on commit 733af41

Please sign in to comment.