summaryrefslogtreecommitdiff
path: root/src/reflect/scala/reflect/api/Types.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-01-27 20:39:04 +0300
committerEugene Burmako <xeno.by@gmail.com>2014-02-14 13:24:47 +0100
commit3293d60531615f4accdee886fba52ddda0929b31 (patch)
tree59f4cf0ab64fe7413ede01e05d89ca2570a52e02 /src/reflect/scala/reflect/api/Types.scala
parent356839e9f33db50d3c25d68ee1f371a1994b0f90 (diff)
downloadscala-3293d60531615f4accdee886fba52ddda0929b31.tar.gz
scala-3293d60531615f4accdee886fba52ddda0929b31.tar.bz2
scala-3293d60531615f4accdee886fba52ddda0929b31.zip
SI-8190 erasure identities for types in reflection API
Makes sure that almost every abstract type declared in reflection API erases to a unique class, so that they can be adequately used for method overloading to the same extent that tags allow them to be used in pattern matching. The only two exceptions from this rule are the types whose implementations we do not control: FlagSet that is implemented as Long and RuntimeClass that is implemented as java.lang.Class[_].
Diffstat (limited to 'src/reflect/scala/reflect/api/Types.scala')
-rw-r--r--src/reflect/scala/reflect/api/Types.scala44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/reflect/scala/reflect/api/Types.scala b/src/reflect/scala/reflect/api/Types.scala
index 4892b46e16..c45ef83a8a 100644
--- a/src/reflect/scala/reflect/api/Types.scala
+++ b/src/reflect/scala/reflect/api/Types.scala
@@ -59,7 +59,7 @@ trait Types {
* @template
* @group Types
*/
- type Type >: Null <: TypeApi
+ type Type >: Null <: AnyRef with TypeApi
/** This constant is used as a special value that indicates that no meaningful type exists.
* @group Types
@@ -256,7 +256,12 @@ trait Types {
* @template
* @group Types
*/
- type SingletonType >: Null <: Type
+ type SingletonType >: Null <: SingletonTypeApi with Type
+
+ /** Has no special methods. Is here to provides erased identity for `SingletonType`.
+ * @group API
+ */
+ trait SingletonTypeApi
/** A singleton type that describes types of the form on the left with the
* corresponding `ThisType` representation to the right:
@@ -266,7 +271,7 @@ trait Types {
* @template
* @group Types
*/
- type ThisType >: Null <: AnyRef with SingletonType with ThisTypeApi
+ type ThisType >: Null <: ThisTypeApi with SingletonType
/** The constructor/extractor for `ThisType` instances.
* @group Extractors
@@ -304,7 +309,7 @@ trait Types {
* @template
* @group Types
*/
- type SingleType >: Null <: AnyRef with SingletonType with SingleTypeApi
+ type SingleType >: Null <: SingleTypeApi with SingletonType
/** The constructor/extractor for `SingleType` instances.
* @group Extractors
@@ -343,7 +348,7 @@ trait Types {
* @template
* @group Types
*/
- type SuperType >: Null <: AnyRef with SingletonType with SuperTypeApi
+ type SuperType >: Null <: SuperTypeApi with SingletonType
/** The constructor/extractor for `SuperType` instances.
* @group Extractors
@@ -382,7 +387,7 @@ trait Types {
* @template
* @group Types
*/
- type ConstantType >: Null <: AnyRef with SingletonType with ConstantTypeApi
+ type ConstantType >: Null <: ConstantTypeApi with SingletonType
/** The constructor/extractor for `ConstantType` instances.
* @group Extractors
@@ -420,7 +425,7 @@ trait Types {
* @template
* @group Types
*/
- type TypeRef >: Null <: AnyRef with Type with TypeRefApi
+ type TypeRef >: Null <: TypeRefApi with Type
/** The constructor/extractor for `TypeRef` instances.
* @group Extractors
@@ -461,7 +466,12 @@ trait Types {
* @template
* @group Types
*/
- type CompoundType >: Null <: AnyRef with Type
+ type CompoundType >: Null <: CompoundTypeApi with Type
+
+ /** Has no special methods. Is here to provides erased identity for `CompoundType`.
+ * @group API
+ */
+ trait CompoundTypeApi
/** The `RefinedType` type defines types of any of the forms on the left,
* with their RefinedType representations to the right.
@@ -473,7 +483,7 @@ trait Types {
* @template
* @group Types
*/
- type RefinedType >: Null <: AnyRef with CompoundType with RefinedTypeApi
+ type RefinedType >: Null <: RefinedTypeApi with CompoundType
/** The constructor/extractor for `RefinedType` instances.
* @group Extractors
@@ -519,7 +529,7 @@ trait Types {
* @template
* @group Types
*/
- type ClassInfoType >: Null <: AnyRef with CompoundType with ClassInfoTypeApi
+ type ClassInfoType >: Null <: ClassInfoTypeApi with CompoundType
/** The constructor/extractor for `ClassInfoType` instances.
* @group Extractors
@@ -556,7 +566,7 @@ trait Types {
* @template
* @group Types
*/
- type MethodType >: Null <: AnyRef with Type with MethodTypeApi
+ type MethodType >: Null <: MethodTypeApi with Type
/** The constructor/extractor for `MethodType` instances.
* @group Extractors
@@ -600,7 +610,7 @@ trait Types {
* @template
* @group Types
*/
- type NullaryMethodType >: Null <: AnyRef with Type with NullaryMethodTypeApi
+ type NullaryMethodType >: Null <: NullaryMethodTypeApi with Type
/** The constructor/extractor for `NullaryMethodType` instances.
* @group Extractors
@@ -630,7 +640,7 @@ trait Types {
* @template
* @group Types
*/
- type PolyType >: Null <: AnyRef with Type with PolyTypeApi
+ type PolyType >: Null <: PolyTypeApi with Type
/** The constructor/extractor for `PolyType` instances.
* @group Extractors
@@ -664,7 +674,7 @@ trait Types {
* @template
* @group Types
*/
- type ExistentialType >: Null <: AnyRef with Type with ExistentialTypeApi
+ type ExistentialType >: Null <: ExistentialTypeApi with Type
/** The constructor/extractor for `ExistentialType` instances.
* @group Extractors
@@ -699,7 +709,7 @@ trait Types {
* @template
* @group Types
*/
- type AnnotatedType >: Null <: AnyRef with Type with AnnotatedTypeApi
+ type AnnotatedType >: Null <: AnnotatedTypeApi with Type
/** The constructor/extractor for `AnnotatedType` instances.
* @group Extractors
@@ -741,7 +751,7 @@ trait Types {
* @template
* @group Types
*/
- type TypeBounds >: Null <: AnyRef with Type with TypeBoundsApi
+ type TypeBounds >: Null <: TypeBoundsApi with Type
/** The constructor/extractor for `TypeBounds` instances.
* @group Extractors
@@ -792,7 +802,7 @@ trait Types {
* @template
* @group Types
*/
- type BoundedWildcardType >: Null <: AnyRef with Type with BoundedWildcardTypeApi
+ type BoundedWildcardType >: Null <: BoundedWildcardTypeApi with Type
/** The constructor/extractor for `BoundedWildcardType` instances.
* @group Extractors