Skip to content

Fix #7679: Use markdown for quoting #7704

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/parsing/JavaScanners.scala
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ object JavaScanners {
nextChar()
token = DOTDOTDOT
}
else error("`.' character expected")
else error("`.` character expected")
}

case ';' =>
Expand Down
26 changes: 13 additions & 13 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 ----------------------------------------------------------- */
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -1797,8 +1797,8 @@ object Parsers {
}
case DO =>
in.errorOrMigrationWarning(
i"""`do <body> while <cond>' is no longer supported,
|use `while ({<body> ; <cond>}) ()' instead.
i"""`do <body> while <cond>` is no longer supported,
|use `while ({<body> ; <cond>}) ()` instead.
|${rewriteNotice("-language:Scala2Compat")}
""")
val start = in.skipToken()
Expand Down Expand Up @@ -2484,15 +2484,15 @@ 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) }
}
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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
}
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/parsing/Scanners.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 _ =>

Expand Down Expand Up @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Namer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions compiler/src/dotty/tools/dotc/typer/RefChecks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) =
Expand Down Expand Up @@ -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

Expand Down
14 changes: 7 additions & 7 deletions compiler/src/dotty/tools/dotc/typer/Variances.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
* <code>tps</code> which correspond to formal type parameters `tparams1'.
/** Compute variance of type parameter `tparam` in all type arguments
* <code>tps</code> 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;
Expand All @@ -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)

Expand Down