File tree 2 files changed +5
-2
lines changed
compiler/src/dotty/tools/dotc
2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ object Decorators {
249
249
extension [T ](x : T )
250
250
def showing [U ](
251
251
op : WrappedResult [U ] ?=> String ,
252
- printer : config.Printers .Printer = config.Printers .default)(using c : Conversion [T , U ] = null ): T = {
252
+ printer : config.Printers .Printer = config.Printers .default)(using c : Conversion [T , U ] | Null = null ): T = {
253
253
// either the use of `$result` was driven by the expected type of `Shown`
254
254
// which led to the summoning of `Conversion[T, Shown]` (which we'll invoke)
255
255
// or no such conversion was found so we'll consume the result as it is instead
@@ -268,7 +268,7 @@ object Decorators {
268
268
if ! ctx.mode.is(Mode .PrintShowExceptions ) && ! ctx.settings.YshowPrintErrors .value =>
269
269
val msg = ex match { case te : TypeError => te.toMessage case _ => ex.getMessage }
270
270
s " [cannot display due to $msg, raw string = $x] "
271
- case _ => String .valueOf(x)
271
+ case _ => String .valueOf(x).nn
272
272
273
273
extension [T ](x : T )
274
274
def assertingErrorsReported (using Context ): T = {
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ object Formatting {
50
50
given [A : Show , B : Show ]: Show [(A , B )] with
51
51
def show (x : (A , B )) = (Show [A ].show(x._1), Show [B ].show(x._2))
52
52
53
+ given [X : Show ]: Show [X | Null ] with
54
+ def show (x : X | Null ) = if x == null then " null" else Show [X ].show(x.nn)
55
+
53
56
given Show [FlagSet ] with
54
57
def show (x : FlagSet ) = x.flagsString
55
58
You can’t perform that action at this time.
0 commit comments