Skip to content

Commit 9a9ce54

Browse files
committed
Drop String overload in ErrorType
1 parent 0df7eae commit 9a9ce54

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ object desugar {
117117
if (local.exists) (defctx.owner.thisType select local).dealiasKeepAnnots
118118
else {
119119
def msg =
120-
s"no matching symbol for ${tp.symbol.showLocated} in ${defctx.owner} / ${defctx.effectiveScope.toList}"
120+
em"no matching symbol for ${tp.symbol.showLocated} in ${defctx.owner} / ${defctx.effectiveScope.toList}"
121121
ErrorType(msg).assertingErrorsReported(msg)
122122
}
123123
case _ =>

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ object Decorators {
287287
assert(ctx.reporter.errorsReported)
288288
x
289289
}
290-
def assertingErrorsReported(msg: => String)(using Context): T = {
290+
def assertingErrorsReported(msg: Message)(using Context): T = {
291291
assert(ctx.reporter.errorsReported, msg)
292292
x
293293
}

compiler/src/dotty/tools/dotc/core/NamerOps.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ object NamerOps:
7070
def findModuleBuddy(name: Name, scope: Scope)(using Context) = {
7171
val it = scope.lookupAll(name).filter(_.is(Module))
7272
if (it.hasNext) it.next()
73-
else NoSymbol.assertingErrorsReported(s"no companion $name in $scope")
73+
else NoSymbol.assertingErrorsReported(em"no companion $name in $scope")
7474
}
7575

7676
/** If a class has one of these flags, it does not get a constructor companion */

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5304,8 +5304,6 @@ object Types {
53045304
val et = new PreviousErrorType
53055305
ctx.base.errorTypeMsg(et) = m
53065306
et
5307-
def apply(s: => String)(using Context): ErrorType =
5308-
apply(s.toMessage)
53095307
end ErrorType
53105308

53115309
class PreviousErrorType extends ErrorType:

compiler/src/dotty/tools/dotc/transform/Splicer.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ object Splicer {
7777
ref(defn.Predef_undefined).withType(ErrorType(ex.msg))
7878
case NonFatal(ex) =>
7979
val msg =
80-
s"""Failed to evaluate macro.
81-
| Caused by ${ex.getClass}: ${if (ex.getMessage == null) "" else ex.getMessage}
82-
| ${ex.getStackTrace.takeWhile(_.getClassName != "dotty.tools.dotc.transform.Splicer$").drop(1).mkString("\n ")}
83-
""".stripMargin
80+
em"""Failed to evaluate macro.
81+
| Caused by ${ex.getClass}: ${if (ex.getMessage == null) "" else ex.getMessage}
82+
| ${ex.getStackTrace.takeWhile(_.getClassName != "dotty.tools.dotc.transform.Splicer$").drop(1).mkString("\n ")}
83+
"""
8484
report.error(msg, spliceExpansionPos)
8585
ref(defn.Predef_undefined).withType(ErrorType(msg))
8686
}

0 commit comments

Comments
 (0)