Skip to content

Commit e603af7

Browse files
committed
chore: drop Option.fromNullable
1 parent 2edd2ef commit e603af7

File tree

5 files changed

+2
-19
lines changed

5 files changed

+2
-19
lines changed

library/src/scala/Predef.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -594,10 +594,6 @@ object Predef extends LowPriorityImplicits {
594594
inline infix def ne(inline y: AnyRef | Null): Boolean =
595595
!(x eq y)
596596

597-
extension (opt: Option.type)
598-
@experimental
599-
inline def fromNullable[T](t: T | Null): Option[T] = Option(t).asInstanceOf[Option[T]]
600-
601597
/** A type supporting Self-based type classes.
602598
*
603599
* A is TC

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ object Predef:
6666
inline infix def ne(inline y: AnyRef | Null): Boolean =
6767
!(x eq y)
6868

69-
extension (opt: Option.type)
70-
@experimental
71-
inline def fromNullable[T](t: T | Null): Option[T] = Option(t).asInstanceOf[Option[T]]
72-
7369
/** A type supporting Self-based type classes.
7470
*
7571
* A is TC

tests/explicit-nulls/neg/from-nullable.scala

Lines changed: 0 additions & 6 deletions
This file was deleted.

tests/explicit-nulls/run/from-nullable.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ object Test:
55
val s1: String | Null = "hello"
66
val s2: String | Null = null
77

8-
val opts1: Option[String] = Option.fromNullable(s1)
9-
val opts2: Option[String] = Option.fromNullable(s2)
8+
val opts1: Option[String] = Option(s1)
9+
val opts2: Option[String] = Option(s2)
1010

1111
opts1 match
1212
case Some(s) => println(s)

tests/run-tasty-inspector/stdlibExperimentalDefinitions.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ val experimentalDefinitionInLibrary = Set(
7979
"scala.quoted.Quotes.reflectModule.RenameSelectorModule.apply",
8080
"scala.quoted.Quotes.reflectModule.SimpleSelectorModule.apply",
8181

82-
// New feature: fromNullable for explicit nulls
83-
"scala.Predef$.fromNullable",
84-
8582
// New feature: modularity
8683
"scala.Precise",
8784
"scala.annotation.internal.WitnessNames",

0 commit comments

Comments
 (0)