File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ object Decorators {
249249 extension [T ](x : T )
250250 def showing [U ](
251251 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 = {
253253 // either the use of `$result` was driven by the expected type of `Shown`
254254 // which led to the summoning of `Conversion[T, Shown]` (which we'll invoke)
255255 // or no such conversion was found so we'll consume the result as it is instead
@@ -268,7 +268,7 @@ object Decorators {
268268 if ! ctx.mode.is(Mode .PrintShowExceptions ) && ! ctx.settings.YshowPrintErrors .value =>
269269 val msg = ex match { case te : TypeError => te.toMessage case _ => ex.getMessage }
270270 s " [cannot display due to $msg, raw string = $x] "
271- case _ => String .valueOf(x)
271+ case _ => String .valueOf(x).nn
272272
273273 extension [T ](x : T )
274274 def assertingErrorsReported (using Context ): T = {
Original file line number Diff line number Diff line change @@ -50,6 +50,9 @@ object Formatting {
5050 given [A : Show , B : Show ]: Show [(A , B )] with
5151 def show (x : (A , B )) = (Show [A ].show(x._1), Show [B ].show(x._2))
5252
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+
5356 given Show [FlagSet ] with
5457 def show (x : FlagSet ) = x.flagsString
5558
You can’t perform that action at this time.
0 commit comments