Types
Members list
Type members
Classlikes
Any type (the top type of this type system).
A variable of this type can contain any value, including undefined
and null
and any JS value. 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 objects.
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).
Any type (the top type of this type system).
A variable of this type can contain any value, including undefined
and null
and any JS value. 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 objects.
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).
Attributes
- Graph
- Supertypes
- Self type
- AnyType.type
Array type.
Array type.
Attributes
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- Self type
- ArrayTypeRef.type
Boolean type.
It does not accept null
nor undefined
.
Boolean type.
It does not accept null
nor undefined
.
Attributes
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PrimTypeWithRefclass PrimTypeclass Typeclass Objecttrait Matchableclass Any
- Self type
- BooleanType.type
8-bit signed integer type.
It does not accept null
nor undefined
.
Char
type, a 16-bit UTF-16 code unit.
It does not accept null
nor undefined
.
Class (or interface) type.
Class (or interface) type.
Attributes
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass NonArrayTypeRefclass TypeRefclass Objecttrait Matchableclass Any
Class (or interface) type.
Class (or interface) type.
Attributes
- Graph
- Supertypes
Double type (64-bit).
It does not accept null
nor undefined
.
Double type (64-bit).
It does not accept null
nor undefined
.
Attributes
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PrimTypeWithRefclass PrimTypeclass Typeclass Objecttrait Matchableclass Any
- Self type
- DoubleType.type
Float type (32-bit).
It does not accept null
nor undefined
.
32-bit signed integer type.
It does not accept null
nor undefined
.
64-bit signed integer type.
It does not accept null
nor undefined
.
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
.
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
.
Attributes
- Graph
- Supertypes
- trait Singletontrait Producttrait Mirrortrait Serializabletrait Producttrait Equalsclass PrimTypeWithRefclass PrimTypeclass Typeclass Objecttrait Matchableclass Any
- Self type
- NothingType.type
The type of null
.
It does not accept undefined
.
The null type is a subtype of all class types and array types.
The type of null
.
It does not accept undefined
.
The null type is a subtype of all class types and array types.
Attributes
Primitive type reference.
Primitive type reference.
Attributes
- Graph
- Supertypes
- trait Serializabletrait Producttrait Equalsclass NonArrayTypeRefclass TypeRefclass Objecttrait Matchableclass Any
Attributes
- Graph
- Supertypes
- Known subtypes
- class PrimTypeWithRefobject BooleanType.typeobject ByteType.typeobject CharType.typeobject DoubleType.typeobject FloatType.typeobject IntType.typeobject LongType.typeobject NoType.typeobject NothingType.typeobject NullType.typeobject ShortType.typeobject StringType.typeobject UndefType.type
Attributes
- Graph
- Supertypes
- Known subtypes
- object BooleanType.typeobject ByteType.typeobject CharType.typeobject DoubleType.typeobject FloatType.typeobject IntType.typeobject LongType.typeobject NoType.typeobject NothingType.typeobject NullType.typeobject ShortType.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 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.
Attributes
- Companion:
- object
- Graph
- Supertypes
Attributes
- Companion:
- class
- Graph
- Supertypes
- Self type
- RecordType.type
16-bit signed integer type.
It does not accept null
nor undefined
.
String type.
It does not accept null
nor undefined
.
String type.
It does not accept null
nor undefined
.
Attributes
- Graph
- Supertypes
- Self type
- StringType.type
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 Type
s,
because java.lang.Object
and JS types all collapse to AnyType.
In fact, there are two Type
s 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.
Attributes
- Graph
- Supertypes
- Known subtypes
- object AnyType.typeclass ArrayTypeclass ClassTypeclass PrimTypeclass PrimTypeWithRefobject BooleanType.typeobject ByteType.typeobject CharType.typeobject DoubleType.typeobject FloatType.typeobject IntType.typeobject LongType.typeobject NoType.typeobject NothingType.typeobject NullType.typeobject ShortType.typeobject StringType.typeobject UndefType.typeclass RecordType
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
(includingscala.Byte
andscala.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.
Attributes
- Graph
- Supertypes
- Known subtypes
Value members
Concrete methods
Tests whether a type lhs
is a subtype of rhs
(or equal).
Tests whether a type lhs
is a subtype of rhs
(or equal).
Attributes
- isSubclass
A function testing whether a class/interface is a subclass of another class/interface.