Skip to content

Commit 42b608b

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 2db5e2a commit 42b608b

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
@@ -118,7 +118,7 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) {
118118
if (kind != overallKind) {
119119
bad = true
120120
report.error(
121-
em"export overload conflicts with export of $firstSym: they are of different types (${kind.show} / ${overallKind.show})",
121+
em"export overload conflicts with export of $firstSym: they are of different types (${kind.tryToShow} / ${overallKind.tryToShow})",
122122
info.pos)
123123
}
124124
}

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
@@ -599,7 +599,7 @@ object Parsers {
599599
if startIndentWidth <= nextIndentWidth then
600600
i"""Line is indented too far to the right, or a `{` is missing before:
601601
|
602-
|${t.show}"""
602+
|${t.tryToShow}"""
603603
else
604604
in.spaceTabMismatchMsg(startIndentWidth, nextIndentWidth),
605605
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
@@ -86,7 +86,7 @@ object Formatting {
8686
* against accidentally treating an interpolated value as a margin.
8787
*/
8888
class StringFormatter(protected val sc: StringContext) {
89-
protected def showArg(arg: Any)(using Context): String = arg.show
89+
protected def showArg(arg: Any)(using Context): String = arg.tryToShow
9090

9191
private def treatArg(arg: Shown, suffix: String)(using Context): (Any, String) = arg match {
9292
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
@@ -774,7 +774,7 @@ private class ExtractAPICollector(using Context) extends ThunkHolder {
774774
case n: Name =>
775775
h = nameHash(n, h)
776776
case elem =>
777-
cannotHash(what = i"`${elem.show}` of unknown class ${elem.getClass}", elem, tree)
777+
cannotHash(what = i"`${elem.tryToShow}` of unknown class ${elem.getClass}", elem, tree)
778778
h
779779
end iteratorHash
780780

0 commit comments

Comments
 (0)