object Types

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Types
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. final case class ArrayType(arrayTypeRef: ArrayTypeRef, nullable: Boolean) extends Type with Product with Serializable

    Array type.

    Array type.

    Although the array type itself may be non-nullable, the *elements* of an array are always nullable for non-primitive types. This is unavoidable, since arrays can be created with their elements initialized with the zero of the element type.

  2. final case class ArrayTypeRef(base: NonArrayTypeRef, dimensions: Int) extends TypeRef with Product with Serializable

    Array type.

  3. final case class ClassRef(className: ClassName) extends NonArrayTypeRef with Product with Serializable

    Class (or interface) type.

  4. final case class ClassType(className: ClassName, nullable: Boolean) extends Type with Product with Serializable

    Class (or interface) type.

  5. final case class ClosureType(paramTypes: List[Type], resultType: Type, nullable: Boolean) extends Type with Product with Serializable

    Closure type.

    Closure type.

    This is the type of a typed closure. Parameters and result are statically typed according to the closureTypeRef components.

    Closure types may be nullable. Null() is a valid value of a nullable closure type. This is unfortunately required to have default values of closure types, which in turn is required to be used as the type of a field.

    Closure types are non-variant in both parameter and result types.

    Closure types are *not* subtypes of AnyType. That statically prevents them from going into JavaScript code or in any other universal context. They do not support type tests nor casts.

    The following subtyping relationships hold for any closure type CT:

    nothing <: CT <: void

    For a nullable closure type CT, additionally the following subtyping relationship holds:

    null <: CT
  6. sealed abstract class NonArrayTypeRef extends TypeRef
  7. final class PrimRef extends NonArrayTypeRef

    Primitive type reference.

  8. sealed abstract class PrimType extends Type
  9. sealed abstract class PrimTypeWithRef extends PrimType
  10. final case class RecordType(fields: List[Field]) extends Type with Product with Serializable

    Record type.

    Record type.

    Used by the optimizer to inline classes as records with multiple fields. They are desugared as several local variables by JSDesugaring. Record types cannot cross method boundaries, so they cannot appear as the type of fields or parameters, nor as result types of methods. The compiler itself never generates record types.

    Record types currently do not feature any form of subtyping. For R1 to be a subtype of R2, it must have the same fields, in the same order, with equivalent types.

    Record types are not subtypes of any. As such, they can never be passed to JavaScript.

  11. final case class TransientTypeRef(name: LabelName)(tpe: Type) extends TypeRef with Product with Serializable

    Transient TypeRef to store any type as a method parameter or result type.

    Transient TypeRef to store any type as a method parameter or result type.

    TransientTypeRef cannot be serialized. It is only used in the linker to support some of its desugarings and/or optimizations.

    TransientTypeRefs cannot be used for methods in the Public namespace.

    The name is used for equality, hashing, and sorting. It is assumed that all occurrences of a TransientTypeRef with the same name associated to an enclosing method namespace (enclosing class, member namespace and simple method name) have the same tpe.

  12. sealed abstract class Type extends AnyRef

    Type of a term (expression or statement) in the IR.

    Type of a term (expression or statement) in the IR.

    There is a many-to-one relationship from TypeRefs to Types, because java.lang.Object and JS types all collapse to AnyType.

    In fact, there are two Types that do not have any real equivalent in type refs: StringType and UndefType, as they refer to the non-null variants of java.lang.String and java.lang.Void, respectively.

  13. sealed abstract class TypeRef extends Comparable[TypeRef]

    Type reference (allowed for classOf[], is/asInstanceOf[]).

    Type reference (allowed for classOf[], is/asInstanceOf[]).

    A TypeRef has exactly the same level of precision as a JVM type. There is a one-to-one relationship between a TypeRef and an instance of java.lang.Class at run-time. This means that:

    • All primitive types have their TypeRef (including scala.Byte and scala.Short), and they are different from their boxed versions.
    • JS types are not erased to any
    • Array types are like on the JVM

    A TypeRef therefore uniquely identifies a classOf[T]. It is also the type refs that are used in method signatures, and which therefore dictate JVM/IR overloading.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final val BooleanRef: PrimRef
  5. final val ByteRef: PrimRef
  6. final val CharRef: PrimRef
  7. final val DoubleRef: PrimRef
  8. final val FloatRef: PrimRef
  9. final val IntRef: PrimRef
  10. final val LongRef: PrimRef
  11. final val NothingRef: PrimRef
  12. final val NullRef: PrimRef
  13. final val ShortRef: PrimRef
  14. final val VoidRef: PrimRef
  15. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  16. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  21. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  23. def isSubtype(lhs: Type, rhs: Type)(isSubclass: (ClassName, ClassName) => Boolean): Boolean

    Tests whether a type lhs is a subtype of rhs (or equal).

    Tests whether a type lhs is a subtype of rhs (or equal).

    isSubclass

    A function testing whether a class/interface is a subclass of another class/interface.

  24. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  25. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  26. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  28. def toString(): String
    Definition Classes
    AnyRef → Any
  29. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  30. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  31. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  32. def zeroOf(tpe: Type)(implicit pos: Position): Tree

    Generates a literal zero of the given type.

  33. case object AnyNotNullType extends Type with Product with Serializable

    Any type except null.

  34. case object AnyType extends Type with Product with Serializable

    Any type.

    Any type.

    This is the supertype of all value types that can be passed to JavaScript code. Record types are the canonical counter-example: they are not subtypes of any because their values cannot be given to JavaScript.

    This type supports a very limited set of Scala operations, the ones common to all values. Basically only reference equality tests and instance tests. It also supports all JavaScript operations, since all Scala objects are also genuine JavaScript values.

    The type java.lang.Object in the back-end maps to AnyType because it can hold JS values (not only instances of Scala.js classes).

  35. object ArrayTypeRef extends Serializable
  36. case object BooleanType extends PrimTypeWithRef with Product with Serializable

    Boolean type.

    Boolean type. It does not accept null nor undefined.

  37. case object ByteType extends PrimTypeWithRef with Product with Serializable

    8-bit signed integer type.

    8-bit signed integer type. It does not accept null nor undefined.

  38. case object CharType extends PrimTypeWithRef with Product with Serializable

    Char type, a 16-bit UTF-16 code unit.

    Char type, a 16-bit UTF-16 code unit. It does not accept null nor undefined.

  39. case object DoubleType extends PrimTypeWithRef with Product with Serializable

    Double type (64-bit).

    Double type (64-bit). It does not accept null nor undefined.

  40. case object FloatType extends PrimTypeWithRef with Product with Serializable

    Float type (32-bit).

    Float type (32-bit). It does not accept null nor undefined.

  41. case object IntType extends PrimTypeWithRef with Product with Serializable

    32-bit signed integer type.

    32-bit signed integer type. It does not accept null nor undefined.

  42. case object LongType extends PrimTypeWithRef with Product with Serializable

    64-bit signed integer type.

    64-bit signed integer type. It does not accept null nor undefined.

  43. case object NothingType extends PrimTypeWithRef with Product with Serializable

    Nothing type (the bottom type of this type system).

    Nothing type (the bottom type of this type system). Expressions from which one can never come back are typed as Nothing. For example, throw and return.

  44. case object NullType extends PrimTypeWithRef with Product with Serializable

    The type of null.

    The type of null. It does not accept undefined. The null type is a subtype of all class types and array types.

  45. object PrimRef
  46. object RecordType extends Serializable
  47. case object ShortType extends PrimTypeWithRef with Product with Serializable

    16-bit signed integer type.

    16-bit signed integer type. It does not accept null nor undefined.

  48. case object StringType extends PrimType with Product with Serializable

    String type.

    String type. It does not accept null nor undefined.

  49. case object UndefType extends PrimType with Product with Serializable

    The type of undefined.

  50. case object VoidType extends PrimTypeWithRef with Product with Serializable

    Void type, the top of type of our type system.

Deprecated Value Members

  1. lazy val NoType: VoidType.type
    Annotations
    @deprecated
    Deprecated

    (Since version 1.18.0) Use VoidType instead

Inherited from AnyRef

Inherited from Any

Ungrouped