Skip to content

Commit 506b5d8

Browse files
committed
Fix #7679: Use markdown for quoting
1 parent 77ca516 commit 506b5d8

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ object JavaScanners {
281281
nextChar()
282282
token = DOTDOTDOT
283283
}
284-
else error("`.' character expected")
284+
else error("`.` character expected")
285285
}
286286

287287
case ';' =>

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ object Parsers {
619619
if in.isNewLine && !(nextIndentWidth < startIndentWidth) then
620620
warning(
621621
if startIndentWidth <= nextIndentWidth then
622-
i"""Line is indented too far to the right, or a `{' is missing before:
622+
i"""Line is indented too far to the right, or a `{` is missing before:
623623
|
624624
|$t"""
625625
else
@@ -638,7 +638,7 @@ object Parsers {
638638
case r: IndentSignificantRegion if in.isNewLine =>
639639
val nextIndentWidth = in.indentWidth(in.next.offset)
640640
if r.indentWidth < nextIndentWidth then
641-
warning(i"Line is indented too far to the right, or a `{' is missing", in.next.offset)
641+
warning(i"Line is indented too far to the right, or a `{` is missing", in.next.offset)
642642
case _ =>
643643

644644
/* -------- REWRITES ----------------------------------------------------------- */
@@ -1277,7 +1277,7 @@ object Parsers {
12771277
if in.token == WITH then
12781278
in.nextToken()
12791279
if in.token != LBRACE && in.token != INDENT then
1280-
syntaxError(i"indented definitions or `{' expected")
1280+
syntaxError(i"indented definitions or `{` expected")
12811281
else
12821282
if silentTemplateIndent && !isNew then in.observeIndented()
12831283
newLineOptWhenFollowedBy(LBRACE)
@@ -1797,8 +1797,8 @@ object Parsers {
17971797
}
17981798
case DO =>
17991799
in.errorOrMigrationWarning(
1800-
i"""`do <body> while <cond>' is no longer supported,
1801-
|use `while ({<body> ; <cond>}) ()' instead.
1800+
i"""`do <body> while <cond>` is no longer supported,
1801+
|use `while ({<body> ; <cond>}) ()` instead.
18021802
|${rewriteNotice("-language:Scala2Compat")}
18031803
""")
18041804
val start = in.skipToken()
@@ -2484,15 +2484,15 @@ object Parsers {
24842484
infixPattern() match {
24852485
case pt @ Ident(tpnme.WILDCARD_STAR) =>
24862486
if (ctx.settings.strict.value)
2487-
in.errorOrMigrationWarning("The syntax `x @ _*' is no longer supported; use `x : _*' instead", Span(startOffset(p)))
2487+
in.errorOrMigrationWarning("The syntax `x @ _*` is no longer supported; use `x : _*` instead", Span(startOffset(p)))
24882488
atSpan(startOffset(p), offset) { Typed(p, pt) }
24892489
case pt =>
24902490
atSpan(startOffset(p), 0) { Bind(name, pt) }
24912491
}
24922492
case p @ Ident(tpnme.WILDCARD_STAR) =>
24932493
// compatibility for Scala2 `_*` syntax
24942494
if (ctx.settings.strict.value)
2495-
in.errorOrMigrationWarning("The syntax `_*' is no longer supported; use `x : _*' instead", Span(startOffset(p)))
2495+
in.errorOrMigrationWarning("The syntax `_*` is no longer supported; use `x : _*` instead", Span(startOffset(p)))
24962496
atSpan(startOffset(p)) { Typed(Ident(nme.WILDCARD), p) }
24972497
case p =>
24982498
p
@@ -2815,7 +2815,7 @@ object Parsers {
28152815
addMod(mods, mod)
28162816
else
28172817
if (!(mods.flags &~ (ParamAccessor | Inline | impliedMods.flags)).isEmpty)
2818-
syntaxError("`val' or `var' expected")
2818+
syntaxError("`val` or `var` expected")
28192819
if (firstClause && ofCaseClass) mods
28202820
else mods | PrivateLocal
28212821
}
@@ -3100,7 +3100,7 @@ object Parsers {
31003100
val toInsert =
31013101
if (in.token == LBRACE) s"$resultTypeStr ="
31023102
else ": Unit " // trailing space ensures that `def f()def g()` works.
3103-
in.testScala2CompatMode(s"Procedure syntax no longer supported; `$toInsert' should be inserted here") && {
3103+
in.testScala2CompatMode(s"Procedure syntax no longer supported; `$toInsert` should be inserted here") && {
31043104
patch(source, Span(in.lastOffset), toInsert)
31053105
true
31063106
}
@@ -3441,7 +3441,7 @@ object Parsers {
34413441
constrApps(commaOK = true, templateCanFollow = true)
34423442
else if in.token == SUBTYPE then
34433443
if !mods.is(Inline) then
3444-
syntaxError("`<:' is only allowed for given with `inline' modifier")
3444+
syntaxError("`<:` is only allowed for given with `inline` modifier")
34453445
in.nextToken()
34463446
TypeBoundsTree(EmptyTree, toplevelTyp()) :: Nil
34473447
else
@@ -3454,7 +3454,7 @@ object Parsers {
34543454
DefDef(name, tparams, vparamss, parents.head, subExpr())
34553455
else
34563456
parents match
3457-
case TypeBoundsTree(_, _) :: _ => syntaxError("`=' expected")
3457+
case TypeBoundsTree(_, _) :: _ => syntaxError("`=` expected")
34583458
case _ =>
34593459
possibleTemplateStart()
34603460
val tparams1 = tparams.map(tparam => tparam.withMods(tparam.mods | PrivateLocal))
@@ -3504,7 +3504,7 @@ object Parsers {
35043504
if (in.token == EXTENDS) {
35053505
in.nextToken()
35063506
if (in.token == LBRACE || in.token == COLONEOL) {
3507-
in.errorOrMigrationWarning("`extends' must be followed by at least one parent")
3507+
in.errorOrMigrationWarning("`extends` must be followed by at least one parent")
35083508
Nil
35093509
}
35103510
else constrApps(commaOK = true, templateCanFollow = true)
@@ -3692,7 +3692,7 @@ object Parsers {
36923692
else if (!isStatSep)
36933693
syntaxErrorOrIncomplete(
36943694
"illegal start of declaration" +
3695-
(if (inFunReturnType) " (possible cause: missing `=' in front of current method body)"
3695+
(if (inFunReturnType) " (possible cause: missing `=` in front of current method body)"
36963696
else ""))
36973697
acceptStatSepUnlessAtEnd()
36983698
}

compiler/src/dotty/tools/dotc/parsing/Scanners.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ object Scanners {
512512
insert(OUTDENT, offset)
513513
skipEndMarker(nextWidth)
514514
case r: InBraces if !closingRegionTokens.contains(token) =>
515-
ctx.warning("Line is indented too far to the left, or a `}' is missing",
515+
ctx.warning("Line is indented too far to the left, or a `}` is missing",
516516
source.atSpan(Span(offset)))
517517
case _ =>
518518

@@ -1095,7 +1095,7 @@ object Scanners {
10951095
finishNamed(target = next)
10961096
}
10971097
else
1098-
error("invalid string interpolation: `$$', `$\"`, `$'ident or `$'BlockExpr expected")
1098+
error("invalid string interpolation: `$$`, `$\"`, `$`ident or `$`BlockExpr expected")
10991099
}
11001100
else {
11011101
val isUnclosedLiteral = !isUnicodeEscape && (ch == SU || (!multiLine && (ch == CR || ch == LF)))

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class Namer { typer: Typer =>
597597
body = fromTempl.body ++ modTempl.body))
598598
if (fromTempl.derived.nonEmpty) {
599599
if (modTempl.derived.nonEmpty)
600-
ctx.error(em"a class and its companion cannot both have `derives' clauses", mdef.sourcePos)
600+
ctx.error(em"a class and its companion cannot both have `derives` clauses", mdef.sourcePos)
601601
res.putAttachment(desugar.DerivingCompanion, fromTempl.sourcePos.startPos)
602602
}
603603
res

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ object RefChecks {
351351
// Also excluded under Scala2 mode are overrides of default methods of Java traits.
352352
if (autoOverride(member) ||
353353
other.owner.isAllOf(JavaInterface) &&
354-
ctx.testScala2CompatMode("`override' modifier required when a Java 8 default method is re-implemented", member.sourcePos))
354+
ctx.testScala2CompatMode("`override` modifier required when a Java 8 default method is re-implemented", member.sourcePos))
355355
member.setFlag(Override)
356356
else if (member.isType && self.memberInfo(member) =:= self.memberInfo(other))
357357
() // OK, don't complain about type aliases which are equal
@@ -362,9 +362,9 @@ object RefChecks {
362362
+ infoStringWithLocation(other) + " and\n " + infoStringWithLocation(member)
363363
+ "\n(Note: this can be resolved by declaring an override in " + clazz + ".)")
364364
else
365-
overrideError("needs `override' modifier")
365+
overrideError("needs `override` modifier")
366366
else if (other.is(AbsOverride) && other.isIncompleteIn(clazz) && !member.is(AbsOverride))
367-
overrideError("needs `abstract override' modifiers")
367+
overrideError("needs `abstract override` modifiers")
368368
else if (member.is(Override) && other.is(Accessor) &&
369369
other.accessedFieldOrGetter.is(Mutable, butNot = Lazy)) {
370370
// !?! this is not covered by the spec. We need to resolve this either by changing the spec or removing the test here.
@@ -652,7 +652,7 @@ object RefChecks {
652652
val mbrType = mbr.info.asSeenFrom(self, mbr.owner)
653653
if (!mbrType.overrides(mbrd.info, matchLoosely = true))
654654
ctx.errorOrMigrationWarning(
655-
em"""${mbr.showLocated} is not a legal implementation of `$name' in $clazz
655+
em"""${mbr.showLocated} is not a legal implementation of `$name` in $clazz
656656
| its type $mbrType
657657
| does not conform to ${mbrd.info}""",
658658
(if (mbr.owner == clazz) mbr else clazz).sourcePos)
@@ -1097,7 +1097,7 @@ class RefChecks extends MiniPhase { thisPhase =>
10971097
10981098
def nonSensibleWarning(what: String, alwaysEqual: Boolean) = {
10991099
val msg = alwaysEqual == (name == nme.EQ || name == nme.eq)
1100-
unit.warning(pos, s"comparing $what using `${name.decode}' will always yield $msg")
1100+
unit.warning(pos, s"comparing $what using `${name.decode}` will always yield $msg")
11011101
isNonSensible = true
11021102
}
11031103
def nonSensible(pre: String, alwaysEqual: Boolean) =
@@ -1557,7 +1557,7 @@ class RefChecks extends MiniPhase { thisPhase =>
15571557
tree
15581558
15591559
case treeInfo.WildcardStarArg(_) if !isRepeatedParamArg(tree) =>
1560-
unit.error(tree.pos, "no `: _*' annotation allowed here\n" +
1560+
unit.error(tree.pos, "no `: _*` annotation allowed here\n" +
15611561
"(such annotations are only allowed in arguments to *-parameters)")
15621562
tree
15631563

0 commit comments

Comments
 (0)