Skip to content

Commit d600684

Browse files
committed
add fromNullable method to object Option
1 parent 6ac8bcd commit d600684

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

+1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ object Predef:
6161
inline def ne(inline y: AnyRef | Null): Boolean =
6262
!(x eq y)
6363

64+
extension (opt: Option.type) def fromNullable[T](t: T|Null): Option[T] = Option(t).asInstanceOf
6465
end Predef

0 commit comments

Comments
 (0)