Skip to content

Commit fb83893

Browse files
committed
Fix Any#className decorator on null
1 parent d78516a commit fb83893

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/src/dotty/tools/dotc/core/Decorators.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ object Decorators {
292292
case _ => String.valueOf(x).nn
293293

294294
/** Returns the simple class name of `x`. */
295-
def className: String = x.getClass.getSimpleName.nn
295+
def className: String = if x == null then "<null>" else x.getClass.getSimpleName.nn
296296

297297
extension [T](x: T)
298298
def assertingErrorsReported(using Context): T = {

0 commit comments

Comments
 (0)