Skip to content

Literal types #420

Closed
Closed
@milessabin

Description

@milessabin

From the initial PR,

  • Literals can now appear in type position, designating the corresponding singleton type.
  • Widening/narrowing behaviour is consistent with 2.11.x and between 2.12.x with the flag enabled and disabled. The use of final on a val definition to explicitly request an unwidened type to be inferred is preserved. Type parameter inference remains the same unless the inference of a singleton type is explicitly requested via a <: Singleton bound.
  • A scala.ValueOf[T] type class and corresponding scala.Predef.valueOf[T] operator has been added yielding the unique value of types with a single inhabitant.
  • isInstanceOf/asInstanceOf tests/conversions are implemented via equality/identity tests for singleton types.
  • Support for scala.Symbol literal types has been added.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions