Skip to content

Commit a96f739

Browse files
committed
Re-apply nullable to Option.apply
1 parent 4344b3d commit a96f739

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

library/src/scala/Option.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object Option {
2828
* @param x the value
2929
* @return Some(value) if value != null, None if value == null
3030
*/
31-
def apply[A](x: A): Option[A] = if (x == null) None else Some(x)
31+
def apply[A](x: A | Null): Option[A] = if (x == null) None else Some(x)
3232

3333
/** An Option factory which returns `None` in a manner consistent with
3434
* the collections hierarchy.

library/src/scala/quoted/FromExpr.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object FromExpr {
104104
*/
105105
given OptionFromExpr[T](using Type[T], FromExpr[T]): FromExpr[Option[T]] with {
106106
def unapply(x: Expr[Option[T]])(using Quotes) = x match {
107-
case '{ Option[T](${Expr(y)}) } => Some(Option(y))
107+
case '{ Option[T](${Expr(y)}: T) } => Some(Option(y))
108108
case '{ None } => Some(None)
109109
case '{ ${Expr(opt)} : Some[T] } => Some(opt)
110110
case _ => None

sbt-bridge/src/xsbt/ConsoleInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import java.util.ArrayList;
77

8-
import scala.Some;
8+
import scala.Option;
99

1010
import xsbti.Logger;
1111

@@ -40,7 +40,7 @@ public void run(
4040
completeArgsList.add(classpathString);
4141
String[] completeArgs = completeArgsList.toArray(args);
4242

43-
ReplDriver driver = new ReplDriver(completeArgs, System.out, Some.apply(loader), ReplDriver.pprintImport());
43+
ReplDriver driver = new ReplDriver(completeArgs, System.out, Option.apply(loader), ReplDriver.pprintImport());
4444

4545
State state = driver.initialState();
4646
assert bindNames.length == bindValues.length;

0 commit comments

Comments
 (0)