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