Skip to content

Disallow type Null in a type pattern or isInstanceOf test #4004

Closed
@allanrenucci

Description

@allanrenucci

Should we disallow type Null in a type pattern or isInstanceOf test like scalac does to avoid surprising behaviors?

Dotty:

scala> null.isInstanceOf[Null]
val res0: Boolean = false

Scalac:

scala> null.isInstanceOf[Null]
<console>:12: error: type Null cannot be used in a type pattern or isInstanceOf test
       null.isInstanceOf[Null]
                        ^

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions