File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -100,9 +100,7 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
100100 val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
101101 val maxPrintCharacters = ctx.settings.VreplMaxPrintCharacters .valueIn(ctx.settingsState)
102102 // stringOf returns null if value.toString returns null. Show some text as a fallback.
103- def toIdentityString (value : Object ): String =
104- s " ${value.getClass.getName}@ ${System .identityHashCode(value).toHexString}"
105- def fallback = s """ ${toIdentityString(value)} // return value of " ${sym.name}.toString" is null """
103+ def fallback = s """ null // result of " ${sym.name}.toString" is null """
106104 if value == null then " null" else
107105 myReplStringOf(value, maxPrintElements, maxPrintCharacters) match
108106 case null => fallback
Original file line number Diff line number Diff line change @@ -436,17 +436,17 @@ class ReplCompilerTests extends ReplTest:
436436 run(" val tpolecat = new Object { override def toString(): String = null }" )
437437 .andThen:
438438 val last = lines().last
439- assertTrue(last, last.startsWith(" val tpolecat: Object = anon " ))
440- assertTrue(last, last.endsWith(""" // return value of "tpolecat.toString" is null""" ))
439+ assertTrue(last, last.startsWith(" val tpolecat: Object = null " ))
440+ assertTrue(last, last.endsWith(""" // result of "tpolecat.toString" is null""" ))
441441
442442 @ Test def `i17333 print toplevel object with null toString` : Unit =
443443 initially :
444444 run(" object tpolecat { override def toString(): String = null }" )
445445 .andThen:
446446 run(" tpolecat" )
447447 val last = lines().last
448- assertTrue(last, last.startsWith(" val res0: tpolecat.type = tpolecat " ))
449- assertTrue(last, last.endsWith(""" // return value of "res0.toString" is null""" ))
448+ assertTrue(last, last.startsWith(" val res0: tpolecat.type = null " ))
449+ assertTrue(last, last.endsWith(""" // result of "res0.toString" is null""" ))
450450
451451object ReplCompilerTests :
452452
You can’t perform that action at this time.
0 commit comments