@@ -70,13 +70,16 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
70
70
// In order to figure out if it did get truncated, we invoke it twice - once with the `maxElements` that we
71
71
// want to print, and once without a limit. If the first is shorter, truncation did occur.
72
72
val notTruncated = stringOfMaybeTruncated(value, Int .MaxValue )
73
- val maybeTruncatedByElementCount = stringOfMaybeTruncated(value, maxElements)
74
- val maybeTruncated = truncate(maybeTruncatedByElementCount, maxCharacters)
75
-
76
- // our string representation may have been truncated by element and/or character count
77
- // if so, append an info string - but only once
78
- if (notTruncated.length == maybeTruncated.length) maybeTruncated
79
- else s " $maybeTruncated ... large output truncated, print value to show all "
73
+ if notTruncated == null then null else
74
+ val maybeTruncated =
75
+ val maybeTruncatedByElementCount = stringOfMaybeTruncated(value, maxElements)
76
+ truncate(maybeTruncatedByElementCount, maxCharacters)
77
+
78
+ // our string representation may have been truncated by element and/or character count
79
+ // if so, append an info string - but only once
80
+ if notTruncated.length == maybeTruncated.length then maybeTruncated
81
+ else s " $maybeTruncated ... large output truncated, print value to show all "
82
+ end if
80
83
}
81
84
82
85
}
@@ -94,8 +97,9 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
94
97
" replStringOf should only be called on values creating using `classLoader()`, but `classLoader()` has not been called so far" )
95
98
val maxPrintElements = ctx.settings.VreplMaxPrintElements .valueIn(ctx.settingsState)
96
99
val maxPrintCharacters = ctx.settings.VreplMaxPrintCharacters .valueIn(ctx.settingsState)
97
- val res = myReplStringOf(value, maxPrintElements, maxPrintCharacters)
98
- if res == null then " null // non-null reference has null-valued toString" else res
100
+ Option (value)
101
+ .flatMap(v => Option (myReplStringOf(v, maxPrintElements, maxPrintCharacters)))
102
+ .getOrElse(" null // non-null reference has null-valued toString" )
99
103
100
104
/** Load the value of the symbol using reflection.
101
105
*
0 commit comments