diff --git a/compiler/src/dotty/tools/dotc/ast/tpd.scala b/compiler/src/dotty/tools/dotc/ast/tpd.scala
index 0713993e3033..feb020ce2b83 100644
--- a/compiler/src/dotty/tools/dotc/ast/tpd.scala
+++ b/compiler/src/dotty/tools/dotc/ast/tpd.scala
@@ -509,7 +509,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
Thicket(valdef, clsdef)
}
- /** A `_' with given type */
+ /** A `_` with given type */
def Underscore(tp: Type)(implicit ctx: Context): Ident = untpd.Ident(nme.WILDCARD).withType(tp)
def defaultValue(tpe: Type)(implicit ctx: Context): Tree = {
@@ -959,7 +959,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
receiver.select(defn.Object_ne).appliedTo(nullLiteral).withSpan(tree.span)
}
- /** If inititializer tree is `_', the default value of its type,
+ /** If inititializer tree is `_`, the default value of its type,
* otherwise the tree itself.
*/
def wildcardToDefault(implicit ctx: Context): Tree =
diff --git a/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala b/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala
index bef78f06e9f0..68007d147085 100644
--- a/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala
@@ -281,7 +281,7 @@ object JavaScanners {
nextChar()
token = DOTDOTDOT
}
- else error("`.' character expected")
+ else error("`.` character expected")
}
case ';' =>
diff --git a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
index 34f871ba7a5b..744274c9266d 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -619,7 +619,7 @@ object Parsers {
if in.isNewLine && !(nextIndentWidth < startIndentWidth) then
warning(
if startIndentWidth <= nextIndentWidth then
- i"""Line is indented too far to the right, or a `{' is missing before:
+ i"""Line is indented too far to the right, or a `{` is missing before:
|
|$t"""
else
@@ -638,7 +638,7 @@ object Parsers {
case r: IndentSignificantRegion if in.isNewLine =>
val nextIndentWidth = in.indentWidth(in.next.offset)
if r.indentWidth < nextIndentWidth then
- warning(i"Line is indented too far to the right, or a `{' is missing", in.next.offset)
+ warning(i"Line is indented too far to the right, or a `{` is missing", in.next.offset)
case _ =>
/* -------- REWRITES ----------------------------------------------------------- */
@@ -1277,7 +1277,7 @@ object Parsers {
if in.token == WITH then
in.nextToken()
if in.token != LBRACE && in.token != INDENT then
- syntaxError(i"indented definitions or `{' expected")
+ syntaxError(i"indented definitions or `{` expected")
else
if silentTemplateIndent && !isNew then in.observeIndented()
newLineOptWhenFollowedBy(LBRACE)
@@ -1797,8 +1797,8 @@ object Parsers {
}
case DO =>
in.errorOrMigrationWarning(
- i"""`do
while ' is no longer supported,
- |use `while ({ ; }) ()' instead.
+ i"""`do while ` is no longer supported,
+ |use `while ({ ; }) ()` instead.
|${rewriteNotice("-language:Scala2Compat")}
""")
val start = in.skipToken()
@@ -2484,7 +2484,7 @@ object Parsers {
infixPattern() match {
case pt @ Ident(tpnme.WILDCARD_STAR) =>
if (ctx.settings.strict.value)
- in.errorOrMigrationWarning("The syntax `x @ _*' is no longer supported; use `x : _*' instead", Span(startOffset(p)))
+ in.errorOrMigrationWarning("The syntax `x @ _*` is no longer supported; use `x : _*` instead", Span(startOffset(p)))
atSpan(startOffset(p), offset) { Typed(p, pt) }
case pt =>
atSpan(startOffset(p), 0) { Bind(name, pt) }
@@ -2492,7 +2492,7 @@ object Parsers {
case p @ Ident(tpnme.WILDCARD_STAR) =>
// compatibility for Scala2 `_*` syntax
if (ctx.settings.strict.value)
- in.errorOrMigrationWarning("The syntax `_*' is no longer supported; use `x : _*' instead", Span(startOffset(p)))
+ in.errorOrMigrationWarning("The syntax `_*` is no longer supported; use `x : _*` instead", Span(startOffset(p)))
atSpan(startOffset(p)) { Typed(Ident(nme.WILDCARD), p) }
case p =>
p
@@ -2815,7 +2815,7 @@ object Parsers {
addMod(mods, mod)
else
if (!(mods.flags &~ (ParamAccessor | Inline | impliedMods.flags)).isEmpty)
- syntaxError("`val' or `var' expected")
+ syntaxError("`val` or `var` expected")
if (firstClause && ofCaseClass) mods
else mods | PrivateLocal
}
@@ -3100,7 +3100,7 @@ object Parsers {
val toInsert =
if (in.token == LBRACE) s"$resultTypeStr ="
else ": Unit " // trailing space ensures that `def f()def g()` works.
- in.testScala2CompatMode(s"Procedure syntax no longer supported; `$toInsert' should be inserted here") && {
+ in.testScala2CompatMode(s"Procedure syntax no longer supported; `$toInsert` should be inserted here") && {
patch(source, Span(in.lastOffset), toInsert)
true
}
@@ -3441,7 +3441,7 @@ object Parsers {
constrApps(commaOK = true, templateCanFollow = true)
else if in.token == SUBTYPE then
if !mods.is(Inline) then
- syntaxError("`<:' is only allowed for given with `inline' modifier")
+ syntaxError("`<:` is only allowed for given with `inline` modifier")
in.nextToken()
TypeBoundsTree(EmptyTree, toplevelTyp()) :: Nil
else
@@ -3454,7 +3454,7 @@ object Parsers {
DefDef(name, tparams, vparamss, parents.head, subExpr())
else
parents match
- case TypeBoundsTree(_, _) :: _ => syntaxError("`=' expected")
+ case TypeBoundsTree(_, _) :: _ => syntaxError("`=` expected")
case _ =>
possibleTemplateStart()
val tparams1 = tparams.map(tparam => tparam.withMods(tparam.mods | PrivateLocal))
@@ -3504,7 +3504,7 @@ object Parsers {
if (in.token == EXTENDS) {
in.nextToken()
if (in.token == LBRACE || in.token == COLONEOL) {
- in.errorOrMigrationWarning("`extends' must be followed by at least one parent")
+ in.errorOrMigrationWarning("`extends` must be followed by at least one parent")
Nil
}
else constrApps(commaOK = true, templateCanFollow = true)
@@ -3692,7 +3692,7 @@ object Parsers {
else if (!isStatSep)
syntaxErrorOrIncomplete(
"illegal start of declaration" +
- (if (inFunReturnType) " (possible cause: missing `=' in front of current method body)"
+ (if (inFunReturnType) " (possible cause: missing `=` in front of current method body)"
else ""))
acceptStatSepUnlessAtEnd()
}
diff --git a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
index 4ec693c6d95e..c4c60bb32613 100644
--- a/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
+++ b/compiler/src/dotty/tools/dotc/parsing/Scanners.scala
@@ -512,7 +512,7 @@ object Scanners {
insert(OUTDENT, offset)
skipEndMarker(nextWidth)
case r: InBraces if !closingRegionTokens.contains(token) =>
- ctx.warning("Line is indented too far to the left, or a `}' is missing",
+ ctx.warning("Line is indented too far to the left, or a `}` is missing",
source.atSpan(Span(offset)))
case _ =>
@@ -1095,7 +1095,7 @@ object Scanners {
finishNamed(target = next)
}
else
- error("invalid string interpolation: `$$', `$\"`, `$'ident or `$'BlockExpr expected")
+ error("invalid string interpolation: `$$`, `$\"`, `$`ident or `$`BlockExpr expected")
}
else {
val isUnclosedLiteral = !isUnicodeEscape && (ch == SU || (!multiLine && (ch == CR || ch == LF)))
diff --git a/compiler/src/dotty/tools/dotc/typer/Namer.scala b/compiler/src/dotty/tools/dotc/typer/Namer.scala
index fb70dec6fd04..c68124141e78 100644
--- a/compiler/src/dotty/tools/dotc/typer/Namer.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Namer.scala
@@ -597,7 +597,7 @@ class Namer { typer: Typer =>
body = fromTempl.body ++ modTempl.body))
if (fromTempl.derived.nonEmpty) {
if (modTempl.derived.nonEmpty)
- ctx.error(em"a class and its companion cannot both have `derives' clauses", mdef.sourcePos)
+ ctx.error(em"a class and its companion cannot both have `derives` clauses", mdef.sourcePos)
res.putAttachment(desugar.DerivingCompanion, fromTempl.sourcePos.startPos)
}
res
diff --git a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
index 57bd34f2f298..750bc7499b50 100644
--- a/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
+++ b/compiler/src/dotty/tools/dotc/typer/RefChecks.scala
@@ -351,7 +351,7 @@ object RefChecks {
// Also excluded under Scala2 mode are overrides of default methods of Java traits.
if (autoOverride(member) ||
other.owner.isAllOf(JavaInterface) &&
- ctx.testScala2CompatMode("`override' modifier required when a Java 8 default method is re-implemented", member.sourcePos))
+ ctx.testScala2CompatMode("`override` modifier required when a Java 8 default method is re-implemented", member.sourcePos))
member.setFlag(Override)
else if (member.isType && self.memberInfo(member) =:= self.memberInfo(other))
() // OK, don't complain about type aliases which are equal
@@ -362,9 +362,9 @@ object RefChecks {
+ infoStringWithLocation(other) + " and\n " + infoStringWithLocation(member)
+ "\n(Note: this can be resolved by declaring an override in " + clazz + ".)")
else
- overrideError("needs `override' modifier")
+ overrideError("needs `override` modifier")
else if (other.is(AbsOverride) && other.isIncompleteIn(clazz) && !member.is(AbsOverride))
- overrideError("needs `abstract override' modifiers")
+ overrideError("needs `abstract override` modifiers")
else if (member.is(Override) && other.is(Accessor) &&
other.accessedFieldOrGetter.is(Mutable, butNot = Lazy)) {
// !?! 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 {
val mbrType = mbr.info.asSeenFrom(self, mbr.owner)
if (!mbrType.overrides(mbrd.info, matchLoosely = true))
ctx.errorOrMigrationWarning(
- em"""${mbr.showLocated} is not a legal implementation of `$name' in $clazz
+ em"""${mbr.showLocated} is not a legal implementation of `$name` in $clazz
| its type $mbrType
| does not conform to ${mbrd.info}""",
(if (mbr.owner == clazz) mbr else clazz).sourcePos)
@@ -1097,7 +1097,7 @@ class RefChecks extends MiniPhase { thisPhase =>
def nonSensibleWarning(what: String, alwaysEqual: Boolean) = {
val msg = alwaysEqual == (name == nme.EQ || name == nme.eq)
- unit.warning(pos, s"comparing $what using `${name.decode}' will always yield $msg")
+ unit.warning(pos, s"comparing $what using `${name.decode}` will always yield $msg")
isNonSensible = true
}
def nonSensible(pre: String, alwaysEqual: Boolean) =
@@ -1557,7 +1557,7 @@ class RefChecks extends MiniPhase { thisPhase =>
tree
case treeInfo.WildcardStarArg(_) if !isRepeatedParamArg(tree) =>
- unit.error(tree.pos, "no `: _*' annotation allowed here\n" +
+ unit.error(tree.pos, "no `: _*` annotation allowed here\n" +
"(such annotations are only allowed in arguments to *-parameters)")
tree
diff --git a/compiler/src/dotty/tools/dotc/typer/Variances.scala b/compiler/src/dotty/tools/dotc/typer/Variances.scala
index c593daa121c3..98fdef09a9a4 100644
--- a/compiler/src/dotty/tools/dotc/typer/Variances.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Variances.scala
@@ -25,21 +25,21 @@ object Variances {
else if (boundsVariance == -1) flip(v)
else cut(v)
- /** Compute variance of type parameter `tparam' in types of all symbols `sym'. */
+ /** Compute variance of type parameter `tparam` in types of all symbols `sym`. */
def varianceInSyms(syms: List[Symbol])(tparam: Symbol)(implicit ctx: Context): Variance =
syms.foldLeft(Bivariant) ((v, sym) => v & varianceInSym(sym)(tparam))
- /** Compute variance of type parameter `tparam' in type of symbol `sym'. */
+ /** Compute variance of type parameter `tparam` in type of symbol `sym`. */
def varianceInSym(sym: Symbol)(tparam: Symbol)(implicit ctx: Context): Variance =
if (sym.isAliasType) cut(varianceInType(sym.info)(tparam))
else varianceInType(sym.info)(tparam)
- /** Compute variance of type parameter `tparam' in all types `tps'. */
+ /** Compute variance of type parameter `tparam` in all types `tps`. */
def varianceInTypes(tps: List[Type])(tparam: Symbol)(implicit ctx: Context): Variance =
tps.foldLeft(Bivariant) ((v, tp) => v & varianceInType(tp)(tparam))
- /** Compute variance of type parameter `tparam' in all type arguments
- * tps
which correspond to formal type parameters `tparams1'.
+ /** Compute variance of type parameter `tparam` in all type arguments
+ * tps
which correspond to formal type parameters `tparams1`.
*/
def varianceInArgs(tps: List[Type], tparams1: List[Symbol])(tparam: Symbol)(implicit ctx: Context): Variance = {
var v: Variance = Bivariant;
@@ -52,11 +52,11 @@ object Variances {
v
}
- /** Compute variance of type parameter `tparam' in all type annotations `annots'. */
+ /** Compute variance of type parameter `tparam` in all type annotations `annots`. */
def varianceInAnnots(annots: List[Annotation])(tparam: Symbol)(implicit ctx: Context): Variance =
annots.foldLeft(Bivariant) ((v, annot) => v & varianceInAnnot(annot)(tparam))
- /** Compute variance of type parameter `tparam' in type annotation `annot'. */
+ /** Compute variance of type parameter `tparam` in type annotation `annot`. */
def varianceInAnnot(annot: Annotation)(tparam: Symbol)(implicit ctx: Context): Variance =
varianceInType(annot.tree.tpe)(tparam)