Skip to content

Commit 03a394b

Browse files
committed
Drop Error parameters in messages
It always goes to `err`, so no need to abstract over it.
1 parent 66f335c commit 03a394b

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import printing.Formatting
1515
import ErrorMessageID._
1616
import ast.Trees
1717
import config.{Feature, ScalaVersion}
18-
import typer.ErrorReporting.{Errors, err}
18+
import typer.ErrorReporting.err
1919
import typer.ProtoTypes.ViewProto
2020
import scala.util.control.NonFatal
2121
import StdNames.nme
@@ -1309,7 +1309,6 @@ object messages {
13091309
}
13101310

13111311
class AmbiguousOverload(tree: tpd.Tree, val alternatives: List[SingleDenotation], pt: Type)(
1312-
err: Errors)(
13131312
implicit ctx: Context)
13141313
extends ReferenceMsg(AmbiguousOverloadID) {
13151314
private def all = if (alternatives.length == 2) "both" else "all"
@@ -1389,8 +1388,7 @@ object messages {
13891388
def explain = em"A fully applied type is expected but $tpe takes $numParams $parameters"
13901389
}
13911390

1392-
class DoesNotConformToBound(tpe: Type, which: String, bound: Type)(
1393-
err: Errors)(implicit ctx: Context)
1391+
class DoesNotConformToBound(tpe: Type, which: String, bound: Type)(implicit ctx: Context)
13941392
extends TypeMismatchMsg(DoesNotConformToBoundID) {
13951393
def msg = em"Type argument ${tpe} does not conform to $which bound $bound${err.whyNoMatchStr(tpe, bound)}"
13961394
def explain = ""
@@ -2141,8 +2139,7 @@ object messages {
21412139
|Refinements cannot contain overloaded definitions.""".stripMargin
21422140
}
21432141

2144-
class NoMatchingOverload(val alternatives: List[SingleDenotation], pt: Type)(
2145-
err: Errors)(using ctx: Context)
2142+
class NoMatchingOverload(val alternatives: List[SingleDenotation], pt: Type)(using ctx: Context)
21462143
extends TypeMismatchMsg(NoMatchingOverloadID) {
21472144
def msg =
21482145
em"""None of the ${err.overloadedAltsStr(alternatives)}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ object Checking {
7171
}
7272
for (arg, which, bound) <- ctx.boundsViolations(args, boundss, instantiate, app) do
7373
ctx.error(
74-
showInferred(DoesNotConformToBound(arg.tpe, which, bound)(err),
74+
showInferred(DoesNotConformToBound(arg.tpe, which, bound),
7575
app, tpt),
7676
arg.sourcePos.focus)
7777

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2796,7 +2796,7 @@ class Typer extends Namer
27962796

27972797
def adaptOverloaded(ref: TermRef) = {
27982798
val altDenots = ref.denot.alternatives
2799-
typr.println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%, %")
2799+
println(i"adapt overloaded $ref with alternatives ${altDenots map (_.info)}%\n\n %")
28002800
val alts = altDenots.map(TermRef(ref.prefix, ref.name, _))
28012801
resolveOverloaded(alts, pt) match {
28022802
case alt :: Nil =>
@@ -2807,7 +2807,7 @@ class Typer extends Namer
28072807
// 2. If context is not an application, pick a alternative that does
28082808
// not take parameters.
28092809
def noMatches =
2810-
errorTree(tree, NoMatchingOverload(altDenots, pt)(err))
2810+
errorTree(tree, NoMatchingOverload(altDenots, pt))
28112811
def hasEmptyParams(denot: SingleDenotation) = denot.info.paramInfoss == ListOfNil
28122812
pt match {
28132813
case pt: FunOrPolyProto if !pt.isUsingApply =>
@@ -2827,7 +2827,7 @@ class Typer extends Namer
28272827
if (tree.tpe.isErroneous || pt.isErroneous) tree.withType(UnspecifiedErrorType)
28282828
else {
28292829
val remainingDenots = alts map (_.denot.asInstanceOf[SingleDenotation])
2830-
errorTree(tree, AmbiguousOverload(tree, remainingDenots, pt)(err))
2830+
errorTree(tree, AmbiguousOverload(tree, remainingDenots, pt))
28312831
}
28322832
}
28332833
}

0 commit comments

Comments
 (0)