Skip to content

Null should be subtype of non-value classes #501

@hearnadam

Description

@hearnadam
/** `Null` is - together with [[scala.Nothing]] - at the bottom of the Scala type hierarchy.
  *
  * `Null` is the type of the `null` literal. It is a subtype of every type
  * except those of value classes. Value classes are subclasses of [[AnyVal]], which includes
  * primitive types such as [[Int]], [[Boolean]], and user-defined value classes.
  *
  * Since `Null` is not a subtype of value types, `null` is not a member of any such type.
  * For instance, it is not possible to assign `null` to a variable of type [[scala.Int]].
  */
sealed trait Null
import izumi.reflect.Tag

Tag[Null] <:< Tag[String] // returns false

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions