Skip to content

Commit c7d109b

Browse files
committed
.
1 parent a4cc58d commit c7d109b

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

compiler/src/dotty/tools/repl/Rendering.scala

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
2626

2727
var myClassLoader: AbstractFileClassLoader = uninitialized
2828

29-
/** (value, maxElements, maxCharacters) => String */
30-
val myReplStringOf: (Object, Int, Int) => String =
31-
dotty.shaded.pprint.PPrinter.BlackWhite.apply(value).plainText
3229

3330
/** Class loader used to load compiled code */
3431
private[repl] def classLoader()(using Context) =
@@ -57,17 +54,7 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
5754

5855
/** Return a String representation of a value we got from `classLoader()`. */
5956
private[repl] def replStringOf(sym: Symbol, value: Object)(using Context): String =
60-
assert(myReplStringOf != null,
61-
"replStringOf should only be called on values creating using `classLoader()`, but `classLoader()` has not been called so far")
62-
val maxPrintElements = ctx.settings.VreplMaxPrintElements.valueIn(ctx.settingsState)
63-
val maxPrintCharacters = ctx.settings.VreplMaxPrintCharacters.valueIn(ctx.settingsState)
64-
// stringOf returns null if value.toString returns null. Show some text as a fallback.
65-
def fallback = s"""null // result of "${sym.name}.toString" is null"""
66-
if value == null then "null" else
67-
myReplStringOf(value, maxPrintElements, maxPrintCharacters) match
68-
case null => fallback
69-
case res => res
70-
end if
57+
dotty.shaded.pprint.PPrinter.BlackWhite.apply(value).plainText
7158

7259
/** Load the value of the symbol using reflection.
7360
*

compiler/test/dotty/tools/repl/ReplCompilerTests.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ class ReplCompilerTests extends ReplTest:
445445
.andThen:
446446
val last = lines().last
447447
assertTrue(last, last.startsWith("val tpolecat: Object = null"))
448-
assertTrue(last, last.endsWith("""// result of "tpolecat.toString" is null"""))
449448

450449
@Test def `i17333 print toplevel object with null toString`: Unit =
451450
initially:
@@ -454,7 +453,6 @@ class ReplCompilerTests extends ReplTest:
454453
run("tpolecat")
455454
val last = lines().last
456455
assertTrue(last, last.startsWith("val res0: tpolecat.type = null"))
457-
assertTrue(last, last.endsWith("""// result of "res0.toString" is null"""))
458456

459457
@Test def `i21431 filter out best effort options`: Unit =
460458
initially:

0 commit comments

Comments
 (0)