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):
100
100
val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
101
101
val maxPrintCharacters = ctx.settings.VreplMaxPrintCharacters .valueIn(ctx.settingsState)
102
102
// 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 """
106
104
if value == null then " null" else
107
105
myReplStringOf(value, maxPrintElements, maxPrintCharacters) match
108
106
case null => fallback
Original file line number Diff line number Diff line change @@ -436,17 +436,17 @@ class ReplCompilerTests extends ReplTest:
436
436
run(" val tpolecat = new Object { override def toString(): String = null }" )
437
437
.andThen:
438
438
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""" ))
441
441
442
442
@ Test def `i17333 print toplevel object with null toString` : Unit =
443
443
initially :
444
444
run(" object tpolecat { override def toString(): String = null }" )
445
445
.andThen:
446
446
run(" tpolecat" )
447
447
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""" ))
450
450
451
451
object ReplCompilerTests :
452
452
You can’t perform that action at this time.
0 commit comments