Dotty Documentation

0.14.0-bin-SNAPSHOT

class Constant
extends Object with Showable with Product1

[-] Constructors

Constant ( value: Any , tag: Int )

[-] Members

[+] val tag : Int
[+] val value : Any
[+] def _1 : Any
[+] def booleanValue : Boolean
[+] def byteValue : Byte
[+] def canEqual ( x: Any ) : Boolean
[+] def charValue : Char
[+] def convertTo ( pt: Type ) ( implicit ctx: Context ) : Constant

Convert constant value to conform to given type.

[+] def doubleValue : Double
[+] private def equalHashValue : Any

Consider two NaNs to be identical, despite non-equality Consider -0d to be distinct from 0d, despite equality

We use the raw versions (i.e. floatToRawIntBits rather than floatToIntBits) to avoid treating different encodings of NaN as the same constant. You probably can't express different NaN varieties as compile time constants in regular Scala code, but it is conceivable that you could conjure them with a macro.

[+] override def equals ( other: Any ) : Boolean

We need the equals method to take account of tags as well as values.

[+] def floatValue : Float
[+] def get : Any
[+] override def hashCode : Int
[+] def intValue : Int
[+] def isAnyVal : Boolean
[+] def isByteRange : Boolean
[+] def isCharRange : Boolean
[+] def isEmpty : Boolean
[+] def isFloatRange : Boolean
[+] def isIntRange : Boolean
[+] def isLongRange : Boolean
[+] def isNaN : Boolean
[+] def isNonUnitAnyVal : Boolean
[+] def isNumeric : Boolean
[+] def isShortRange : Boolean
[+] def longValue : Long
[+] def scalaSymbolValue : Symbol
[+] def shortValue : Short
[+] def stringValue : String
[+] def symbolValue : Symbol
[+] override def toString : String
[+] def toText ( printer: Printer ) : Text

The text representation of this showable element. This normally dispatches to a pattern matching method in Printers.

[+] def tpe ( implicit ctx: Context ) : Type
[+] def typeValue : Type