Skip to content

Commit

Permalink
add fromNullable method to object Option
Browse files Browse the repository at this point in the history
  • Loading branch information
olhotak committed Jul 13, 2023
1 parent 6ac8bcd commit d600684
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/src/scala/runtime/stdLibPatches/Predef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ object Predef:
inline def ne(inline y: AnyRef | Null): Boolean =
!(x eq y)

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

0 comments on commit d600684

Please sign in to comment.