Skip to content

-Yexplicit-nulls does not play nicely with Option.apply #22195

Open
@j-mie6

Description

@j-mie6

Compiler version

3.5.2

Minimized example

//> using options -Yexplicit-nulls

class Foo
Option[Foo](null)

Output

Gives a type error that expected Foo but got Null. Fine, except the point of Option.apply is that it is a null-safe wrapper into Option.

Expectation

Realistically, its type needs to be def apply[A](x: A | Null): Option[A] when that flag is turned on, otherwise it's now useless.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions