TypeRef
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.