From cc44db85e712f91630526c5a2324f1ad12a2b32b Mon Sep 17 00:00:00 2001 From: Ondrej Lhotak Date: Mon, 9 May 2022 22:31:08 +0200 Subject: [PATCH] add comment --- library/src/scala/runtime/stdLibPatches/Predef.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/src/scala/runtime/stdLibPatches/Predef.scala b/library/src/scala/runtime/stdLibPatches/Predef.scala index 64e76d3b8fd9..a45e179d166b 100644 --- a/library/src/scala/runtime/stdLibPatches/Predef.scala +++ b/library/src/scala/runtime/stdLibPatches/Predef.scala @@ -50,6 +50,9 @@ object Predef: extension [T](x: T | Null) inline def nn: x.type & T = scala.runtime.Scala3RunTime.nn(x) + /** Enables an expression of type `T|Null`, where `T` is a subtype of AnyRef, to be checked for `null` + * using `eq` and `ne`, rather than only `==` and `!=`. This is needed because `Null` no longer has + * `eq` or `ne` methods, only `==` and `!=` inherited from `Any`. */ extension (inline x: AnyRef | Null) @experimental inline def eq(inline y: AnyRef | Null): Boolean =