diff --git a/compiler/src/dotty/tools/dotc/core/Decorators.scala b/compiler/src/dotty/tools/dotc/core/Decorators.scala index d392a4e3079a..54faf9a41177 100644 --- a/compiler/src/dotty/tools/dotc/core/Decorators.scala +++ b/compiler/src/dotty/tools/dotc/core/Decorators.scala @@ -274,6 +274,9 @@ object Decorators { s"[cannot display due to $msg, raw string = $x]" case _ => String.valueOf(x).nn + /** Returns the simple class name of `x`. */ + def className: String = getClass.getSimpleName.nn + extension [T](x: T) def assertingErrorsReported(using Context): T = { assert(ctx.reporter.errorsReported)