Skip to content

Commit 603973e

Browse files
dwijnandtgodzik
authored andcommitted
Fix Any#className decorator on null
[Cherry-picked fb83893]
1 parent 267b9ce commit 603973e

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
@@ -284,7 +284,7 @@ object Decorators {
284284
case _ => String.valueOf(x).nn
285285

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

289289
extension [T](x: T)
290290
def assertingErrorsReported(using Context): T = {

0 commit comments

Comments
 (0)