Skip to content

Commit c945ae8

Browse files
LinyxusWojciechMazur
authored andcommitted
Cleanup
[Cherry-picked 36aac1e]
1 parent eaebc99 commit c945ae8

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ private sealed trait YSettings:
444444
val YbestEffort: Setting[Boolean] = BooleanSetting(ForkSetting, "Ybest-effort", "Enable best-effort compilation attempting to produce betasty to the META-INF/best-effort directory, regardless of errors, as part of the pickler phase.")
445445
val YwithBestEffortTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Ywith-best-effort-tasty", "Allow to compile using best-effort tasty files. If such file is used, the compiler will stop after the pickler phase.")
446446

447-
val YmagicOffsetHeader: Setting[String] = StringSetting(AdvancedSetting, "Ymagic-offset-header", "header", "Specify the magic header comment that marks the start of the actual code in generated wrapper scripts. Example: -Ymagic-offset-header:SOURCE_CODE_START", "")
448-
val YoriginalSourceHeader: Setting[String] = StringSetting(AdvancedSetting, "Yoriginal-source-header", "header", "Specify the magic header comment that marks the path of the original code in generated wrapper scripts. Example: -Ymagic-offset-header:ORIGINAL_SOURCE_CODE_PATH", "")
447+
val YmagicOffsetHeader: Setting[String] = StringSetting(AdvancedSetting, "Ymagic-offset-header", "header", "Specify the magic header comment that marks the start of the actual code in generated wrapper scripts. Example: -Ymagic-offset-header:SOURCE_CODE_START. Then, in the source, the magic comment `///SOURCE_CODE_START` marks the start of user code. The comment can be optionally suffixed by `:<ORIGINAL_FILE_PATH>` to indicate the original file.", "")
449448

450449
// Experimental language features
451450
@deprecated(message = "This flag has no effect and will be removed in a future version.", since = "3.7.0")

compiler/src/dotty/tools/dotc/reporting/MessageRendering.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import core.Decorators.*
1111
import printing.Highlighting.{Blue, Red, Yellow}
1212
import printing.SyntaxHighlighting
1313
import Diagnostic.*
14-
import util.{ SourcePosition, NoSourcePosition, WrappedSourceFile }
14+
import util.{SourcePosition, NoSourcePosition}
1515
import util.Chars.{ LF, CR, FF, SU }
1616
import scala.annotation.switch
1717

@@ -44,10 +44,7 @@ trait MessageRendering {
4444
var maxLen = Int.MinValue
4545
def render(offsetAndLine: (Int, String)): String = {
4646
val (offset1, line) = offsetAndLine
47-
var magicOffset = WrappedSourceFile.locateMagicHeader(pos.source).getOrElse(0)
48-
val lineId = pos.source.offsetToLine(offset1)
49-
if lineId < magicOffset then magicOffset = 0
50-
val lineNbr = (lineId + 1 - magicOffset).toString
47+
val lineNbr = (pos.source.offsetToLine(offset1) + 1).toString
5148
val prefix = String.format(s"%${offset - 2}s |", lineNbr)
5249
maxLen = math.max(maxLen, prefix.length)
5350
val lnum = hl(" " * math.max(0, maxLen - prefix.length - 1) + prefix)

0 commit comments

Comments
 (0)