Erased types are:
ErasedValueType TypeRef(prefix is ignored, denot is ClassDenotation) TermRef(prefix is ignored, denot is SymDenotation) JavaArrayType AnnotatedType MethodType ThisType SuperType ClassInfo (NoPrefix, ...) NoType NoPrefix WildcardType ErrorType
only for isInstanceOf, asInstanceOf: PolyType, TypeParamRef, TypeBounds
A type representing the semi-erasure of a derived value class, see SIP-15 where it's called "C$unboxed" for a class C. Derived value classes are erased to this type during Erasure (when semiEraseVCs = true) and subsequently erased to their underlying type during ElimErasedValueType. This type is outside the normal Scala class hierarchy: it is a subtype of no other type and is a supertype only of Nothing. This is because this type is only useful for type adaptation (see [[Erasure.Boxing#adaptToType]]).
The erased greatest lower bound picks one of the two argument types. It prefers, in this order: - arrays over non-arrays - subtypes over supertypes, unless isJava is set - real classes over traits
The erased least upper bound is computed as follows
- if both argument are arrays of objects, an array of the erased lub of the element types
- if both arguments are arrays of same primitives, an array of this primitive
- if one argument is array of primitives and the other is array of objects, Object
- if one argument is an array, Object
- otherwise a common superclass or trait S of the argument classes, with the
following two properties:
S is minimal: no other common superclass or trait derives from S
S is last : in the linearization of the first argument type
there are no minimal common superclasses or traits that
come after S.
The reason to pick last is that we prefer classes over traits that way,
which leads to more predictable bytecode and (?) faster dynamic dispatch.
The erasure of a top-level reference. Differs from normal erasure in that TermRefs are kept instead of being widened away.
The standard erasure of a Scala type. Value classes are erased as normal classes.
The current context with a phase no later than erasure
Produces an erasure function. See the documentation of the class [[TypeErasure]] for a description of each parameter.
Does the (possibly generic) type
tp have the same erasure in all its
A predicate that tests whether a type is a legal erased type. Only asInstanceOf and isInstanceOf may have types that do not satisfy the predicate. ErasedValueType is considered an erased type because it is valid after Erasure (it is eliminated by ElimErasedValueType).
tp an abstract type or polymorphic type parameter, or another unbounded generic type?
tp an abstract type or polymorphic type parameter that has
or a universal trait as upper bound and that is not Java defined? Arrays of such types are
Object instead of
The symbol's erased info. This is the type's erasure, except for the following symbols:
- For $asInstanceOf : [T]T
- For $isInstanceOf : [T]Boolean
- For all abstract types : = ?
- For companion methods : the erasure of their type with semiEraseVCs = false. The signature of these methods are used to keep a link between companions and should not be semi-erased.
- For Java-defined symbols: : the erasure of their type with isJava = true, semiEraseVCs = false. Semi-erasure never happens in Java.
- For all other symbols : the semi-erasure of their types, with isJava, isConstructor set according to symbol.