class
TypeErasure
extends
DotClass
Constructors
TypeErasure
(
isJava:
Boolean
,
semiEraseVCs:
Boolean
,
isConstructor:
Boolean
,
wildcardOK:
Boolean
)
Members
private
val
isConstructor
: Boolean
private
val
isJava
: Boolean
private
val
semiEraseVCs
: Boolean
private
val
wildcardOK
: Boolean
private
def
apply
(
tp:
Type
)
(
implicit
ctx:
Context
)
: Type
The erasure |T| of a type T. This is:
- For a refined type scala.Array+[T]:
- if T is Nothing or Null, []Object
- otherwise, if T <: Object, []|T|
- otherwise, if T is a type paramter coming from Java, []Object
- otherwise, Object
- For a term ref p.x, the type
# x. - For a typeref scala.Any, scala.AnyVal or scala.Singleton: |java.lang.Object|
- For a typeref scala.Unit, |scala.runtime.BoxedUnit|.
- For a typeref scala.FunctionN, where N > MaxImplementedFunctionArity, scala.FunctionXXL
- For a typeref scala.ImplicitFunctionN, | scala.FunctionN |
- For a typeref P.C where C refers to a class,
# C. - For a typeref P.C where C refers to an alias type, the erasure of C's alias.
- For a typeref P.C where C refers to an abstract type, the erasure of C's upper bound.
- For a this-type C.this, the type itself.
- For all other type proxies: The erasure of the underlying type.
- For T1 & T2, the erased glb of |T1| and |T2| (see erasedGlb)
- For T1 | T2, the first base class in the linearization of T which is also a base class of T2
- For => T, ()T
- For a method type (Fs)scala.Unit, (|Fs|)scala.Unit.
- For any other uncurried method type (Fs)T, (|Fs|)|T|.
- For a curried method type (Fs1)(Fs2)T, (|Fs1|,Es2)ET where (Es2)ET = |(Fs2)T|.
- For a polymorphic type TsT, |(Ps)T| _ For a polymorphic type [Ts]T where T is not a method type, ()|T|
- For the class info type of java.lang.Object, the same type without any parents.
- For a class info type of a value class, the same type without any parents.
- For any other class info type with parents Ps, the same type with parents |Ps|, but with duplicate references of Object removed.
- For NoType or NoPrefix, the type itself.
- For any other type, exception.
The erasure |T| of a type T. This is:
- For a refined type scala.Array+[T]:
- if T is Nothing or Null, []Object
- otherwise, if T <: Object, []|T|
- otherwise, if T is a type paramter coming from Java, []Object
- otherwise, Object
- For a term ref p.x, the type
# x. - For a typeref scala.Any, scala.AnyVal or scala.Singleton: |java.lang.Object|
- For a typeref scala.Unit, |scala.runtime.BoxedUnit|.
- For a typeref scala.FunctionN, where N > MaxImplementedFunctionArity, scala.FunctionXXL
- For a typeref scala.ImplicitFunctionN, | scala.FunctionN |
- For a typeref P.C where C refers to a class,
# C. - For a typeref P.C where C refers to an alias type, the erasure of C's alias.
- For a typeref P.C where C refers to an abstract type, the erasure of C's upper bound.
- For a this-type C.this, the type itself.
- For all other type proxies: The erasure of the underlying type.
- For T1 & T2, the erased glb of |T1| and |T2| (see erasedGlb)
- For T1 | T2, the first base class in the linearization of T which is also a base class of T2
- For => T, ()T
- For a method type (Fs)scala.Unit, (|Fs|)scala.Unit.
- For any other uncurried method type (Fs)T, (|Fs|)|T|.
- For a curried method type (Fs1)(Fs2)T, (|Fs1|,Es2)ET where (Es2)ET = |(Fs2)T|.
- For a polymorphic type TsT, |(Ps)T| _ For a polymorphic type [Ts]T where T is not a method type, ()|T|
- For the class info type of java.lang.Object, the same type without any parents.
- For a class info type of a value class, the same type without any parents.
- For any other class info type with parents Ps, the same type with parents |Ps|, but with duplicate references of Object removed.
- For NoType or NoPrefix, the type itself.
- For any other type, exception.
private
def
eraseArray
(
tp:
RefinedType
)
(
implicit
ctx:
Context
)
: TypeRef | CachedJavaArrayType
private
def
eraseDerivedValueClassRef
(
tref:
TypeRef
)
(
implicit
ctx:
Context
)
: Type
def
eraseInfo
(
tp:
Type
,
sym:
Symbol
)
(
implicit
ctx:
Context
)
: Type
The erasure of a symbol's info. This is different from apply
in the way ExprType
s and
PolyType
s are treated. eraseInfo
maps them them to method types,...
The erasure of a symbol's info. This is different from apply
in the way ExprType
s and
PolyType
s are treated. eraseInfo
maps them them to method types, whereas apply
maps them
to the underlying type.
private
def
eraseNormalClassRef
(
tref:
TypeRef
)
(
implicit
ctx:
Context
)
: Type
private
def
eraseResult
(
tp:
Type
)
(
implicit
ctx:
Context
)
: Type
The erasure of a function result type.
The erasure of a function result type.
private
def
normalizeClass
(
cls:
ClassSymbol
)
(
implicit
ctx:
Context
)
: ClassSymbol
private
def
sigName
(
tp:
Type
)
(
implicit
ctx:
Context
)
: TypeName
The name of the type as it is used in Signature
s.
Need to ensure correspondence with erasure!
The name of the type as it is used in Signature
s.
Need to ensure correspondence with erasure!