Skip to content

Commit a5a7644

Browse files
authored
chore: mark eq and ne in Predef as infix (#23255)
For consistency with #23252 Note that `infix` here is not need because that parent's symbol is changed to `scala.Predef`, which is considered Scala 2 code. I guess we can define extension methods in scala 2, at least from dotty internal's point of view 😅
2 parents 74e45cf + 7f6b9b9 commit a5a7644

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/src/scala/runtime/stdLibPatches/Predef.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ object Predef:
5656
/** Enables an expression of type `T|Null`, where `T` is a subtype of `AnyRef`, to be checked for `null`
5757
* using `eq` rather than only `==`. This is needed because `Null` no longer has
5858
* `eq` or `ne` methods, only `==` and `!=` inherited from `Any`. */
59-
inline def eq(inline y: AnyRef | Null): Boolean =
59+
inline infix def eq(inline y: AnyRef | Null): Boolean =
6060
x.asInstanceOf[AnyRef] eq y.asInstanceOf[AnyRef]
6161
/** Enables an expression of type `T|Null`, where `T` is a subtype of `AnyRef`, to be checked for `null`
6262
* using `ne` rather than only `!=`. This is needed because `Null` no longer has
6363
* `eq` or `ne` methods, only `==` and `!=` inherited from `Any`. */
64-
inline def ne(inline y: AnyRef | Null): Boolean =
64+
inline infix def ne(inline y: AnyRef | Null): Boolean =
6565
!(x eq y)
6666

6767
extension (opt: Option.type)

0 commit comments

Comments
 (0)