Skip to content

Commit 2afe70a

Browse files
committed
Rename to Any#tryToShow as it's not Show-based
It was also being used over TypeComparer.ApproxState's show extension method (for unclear reasons), so let's avoid name confusion too.
1 parent 3785a21 commit 2afe70a

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) {
119119
if (kind != overallKind) {
120120
bad = true
121121
report.error(
122-
em"export overload conflicts with export of $firstSym: they are of different types (${kind.show} / ${overallKind.show})",
122+
em"export overload conflicts with export of $firstSym: they are of different types (${kind.tryToShow} / ${overallKind.tryToShow})",
123123
info.pos)
124124
}
125125
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ object Decorators {
259259
}
260260

261261
/** Instead of `toString` call `show` on `Showable` values, falling back to `toString` if an exception is raised. */
262-
def show(using Context): String = x match
262+
def tryToShow(using Context): String = x match
263263
case x: Showable =>
264264
try x.show
265265
catch

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ object Parsers {
603603
if startIndentWidth <= nextIndentWidth then
604604
i"""Line is indented too far to the right, or a `{` is missing before:
605605
|
606-
|${t.show}"""
606+
|${t.tryToShow}"""
607607
else
608608
in.spaceTabMismatchMsg(startIndentWidth, nextIndentWidth),
609609
in.next.offset

compiler/src/dotty/tools/dotc/printing/Formatting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ object Formatting {
8888
* against accidentally treating an interpolated value as a margin.
8989
*/
9090
class StringFormatter(protected val sc: StringContext) {
91-
protected def showArg(arg: Any)(using Context): String = arg.show
91+
protected def showArg(arg: Any)(using Context): String = arg.tryToShow
9292

9393
private def treatArg(arg: Shown, suffix: String)(using Context): (Any, String) = arg match {
9494
case arg: Seq[?] if suffix.nonEmpty && suffix.head == '%' =>

compiler/src/dotty/tools/dotc/sbt/ExtractAPI.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ private class ExtractAPICollector(using Context) extends ThunkHolder {
776776
case n: Name =>
777777
h = nameHash(n, h)
778778
case elem =>
779-
cannotHash(what = i"`${elem.show}` of unknown class ${elem.getClass}", elem, tree)
779+
cannotHash(what = i"`${elem.tryToShow}` of unknown class ${elem.getClass}", elem, tree)
780780
h
781781
end iteratorHash
782782

0 commit comments

Comments
 (0)