summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/reflect/scala/reflect/api/Annotations.scala12
-rw-r--r--src/reflect/scala/reflect/api/Mirrors.scala7
-rw-r--r--src/reflect/scala/reflect/api/Names.scala16
-rw-r--r--src/reflect/scala/reflect/api/Position.scala2
-rw-r--r--src/reflect/scala/reflect/api/Positions.scala3
-rw-r--r--src/reflect/scala/reflect/api/Scopes.scala4
-rw-r--r--src/reflect/scala/reflect/api/Symbols.scala16
-rw-r--r--src/reflect/scala/reflect/api/Trees.scala106
-rw-r--r--src/reflect/scala/reflect/api/Types.scala44
-rw-r--r--src/reflect/scala/reflect/internal/AnnotationInfos.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Names.scala4
-rw-r--r--src/reflect/scala/reflect/internal/Trees.scala2
-rw-r--r--src/reflect/scala/reflect/internal/Types.scala4
13 files changed, 126 insertions, 96 deletions
diff --git a/src/reflect/scala/reflect/api/Annotations.scala b/src/reflect/scala/reflect/api/Annotations.scala
index 4fec7a09ae..5171a2e047 100644
--- a/src/reflect/scala/reflect/api/Annotations.scala
+++ b/src/reflect/scala/reflect/api/Annotations.scala
@@ -83,14 +83,18 @@ trait Annotations { self: Universe =>
* @template
* @group Annotations
*/
- type JavaArgument >: Null <: AnyRef
+ type JavaArgument >: Null <: AnyRef with JavaArgumentApi
+ /** Has no special methods. Is here to provides erased identity for `CompoundType`.
+ * @group API
+ */
+ trait JavaArgumentApi
/** A literal argument to a Java annotation as `"Use X instead"` in `@Deprecated("Use X instead")`
* @template
* @group Annotations
*/
- type LiteralArgument >: Null <: AnyRef with JavaArgument with LiteralArgumentApi
+ type LiteralArgument >: Null <: LiteralArgumentApi with JavaArgument
/** The constructor/extractor for `LiteralArgument` instances.
* @group Extractors
@@ -119,7 +123,7 @@ trait Annotations { self: Universe =>
* @template
* @group Annotations
*/
- type ArrayArgument >: Null <: AnyRef with JavaArgument with ArrayArgumentApi
+ type ArrayArgument >: Null <: ArrayArgumentApi with JavaArgument
/** The constructor/extractor for `ArrayArgument` instances.
* @group Extractors
@@ -148,7 +152,7 @@ trait Annotations { self: Universe =>
* @template
* @group Annotations
*/
- type NestedArgument >: Null <: AnyRef with JavaArgument with NestedArgumentApi
+ type NestedArgument >: Null <: NestedArgumentApi with JavaArgument
/** The constructor/extractor for `NestedArgument` instances.
* @group Extractors
diff --git a/src/reflect/scala/reflect/api/Mirrors.scala b/src/reflect/scala/reflect/api/Mirrors.scala
index f11b9a5c55..0d39f628ce 100644
--- a/src/reflect/scala/reflect/api/Mirrors.scala
+++ b/src/reflect/scala/reflect/api/Mirrors.scala
@@ -225,7 +225,12 @@ trait Mirrors { self: Universe =>
/** Abstracts the runtime representation of a class on the underlying platform.
* @group Mirrors
*/
- type RuntimeClass >: Null
+ type RuntimeClass >: Null <: AnyRef
+
+ /** Has no special methods. Is here to provides erased identity for `RuntimeClass`.
+ * @group API
+ */
+ trait RuntimeClassApi
// todo. an improvement might be having mirrors reproduce the structure of the reflection domain
// e.g. a ClassMirror could also have a list of fields, methods, constructors and so on
diff --git a/src/reflect/scala/reflect/api/Names.scala b/src/reflect/scala/reflect/api/Names.scala
index 87d7f9fd8e..23436ca8e7 100644
--- a/src/reflect/scala/reflect/api/Names.scala
+++ b/src/reflect/scala/reflect/api/Names.scala
@@ -44,17 +44,27 @@ trait Names {
/** The abstract type of names.
* @group Names
*/
- type Name >: Null <: NameApi
+ type Name >: Null <: AnyRef with NameApi
/** The abstract type of names representing terms.
* @group Names
*/
- type TypeName >: Null <: Name
+ type TypeName >: Null <: TypeNameApi with Name
+
+ /** Has no special methods. Is here to provides erased identity for `TypeName`.
+ * @group API
+ */
+ trait TypeNameApi
/** The abstract type of names representing types.
* @group Names
*/
- type TermName >: Null <: Name
+ type TermName >: Null <: TermNameApi with Name
+
+ /** Has no special methods. Is here to provides erased identity for `TermName`.
+ * @group API
+ */
+ trait TermNameApi
/** The API of Name instances.
* @group API
diff --git a/src/reflect/scala/reflect/api/Position.scala b/src/reflect/scala/reflect/api/Position.scala
index 2019e2f1d9..891d3a43ef 100644
--- a/src/reflect/scala/reflect/api/Position.scala
+++ b/src/reflect/scala/reflect/api/Position.scala
@@ -20,7 +20,7 @@ import scala.reflect.macros.Attachments
trait Position extends Attachments {
/** @inheritdoc */
- type Pos >: Null <: Position
+ type Pos >: Null <: AnyRef with Position
/** Java file corresponding to the source file of this position.
*
diff --git a/src/reflect/scala/reflect/api/Positions.scala b/src/reflect/scala/reflect/api/Positions.scala
index 8ad46418f8..63ad605656 100644
--- a/src/reflect/scala/reflect/api/Positions.scala
+++ b/src/reflect/scala/reflect/api/Positions.scala
@@ -19,7 +19,8 @@ trait Positions {
* The main documentation entry about positions is located at [[scala.reflect.api.Position]].
* @group Positions
*/
- type Position >: Null <: scala.reflect.api.Position { type Pos = Position }
+ type Position >: Null <: AnyRef with scala.reflect.api.Position { type Pos = Position }
+
/** A special "missing" position.
* @group Positions
*/
diff --git a/src/reflect/scala/reflect/api/Scopes.scala b/src/reflect/scala/reflect/api/Scopes.scala
index 2eb477f652..9327fb9762 100644
--- a/src/reflect/scala/reflect/api/Scopes.scala
+++ b/src/reflect/scala/reflect/api/Scopes.scala
@@ -27,7 +27,7 @@ trait Scopes { self: Universe =>
* @template
* @group Scopes
*/
- type Scope >: Null <: ScopeApi
+ type Scope >: Null <: AnyRef with ScopeApi
/** The API that all scopes support
* @group API
@@ -43,7 +43,7 @@ trait Scopes { self: Universe =>
* @template
* @group Scopes
*/
- type MemberScope >: Null <: Scope with MemberScopeApi
+ type MemberScope >: Null <: AnyRef with MemberScopeApi with Scope
/** The API that all member scopes support
* @group API
diff --git a/src/reflect/scala/reflect/api/Symbols.scala b/src/reflect/scala/reflect/api/Symbols.scala
index 7dd5bcc4ab..562129d893 100644
--- a/src/reflect/scala/reflect/api/Symbols.scala
+++ b/src/reflect/scala/reflect/api/Symbols.scala
@@ -60,51 +60,51 @@ trait Symbols { self: Universe =>
* @group Symbols
* @template
*/
- type Symbol >: Null <: SymbolApi
+ type Symbol >: Null <: AnyRef with SymbolApi
/** The type of type symbols representing type, class, and trait declarations,
* as well as type parameters.
* @group Symbols
* @template
*/
- type TypeSymbol >: Null <: Symbol with TypeSymbolApi
+ type TypeSymbol >: Null <: TypeSymbolApi with Symbol
/** The type of term symbols representing val, var, def, and object declarations as
* well as packages and value parameters.
* @group Symbols
* @template
*/
- type TermSymbol >: Null <: Symbol with TermSymbolApi
+ type TermSymbol >: Null <: TermSymbolApi with Symbol
/** The type of method symbols representing def declarations.
* @group Symbols
* @template
*/
- type MethodSymbol >: Null <: TermSymbol with MethodSymbolApi
+ type MethodSymbol >: Null <: MethodSymbolApi with TermSymbol
/** The type of module symbols representing object declarations.
* @group Symbols
* @template
*/
- type ModuleSymbol >: Null <: TermSymbol with ModuleSymbolApi
+ type ModuleSymbol >: Null <: ModuleSymbolApi with TermSymbol
/** The type of class symbols representing class and trait definitions.
* @group Symbols
* @template
*/
- type ClassSymbol >: Null <: TypeSymbol with ClassSymbolApi
+ type ClassSymbol >: Null <: ClassSymbolApi with TypeSymbol
/** The type of free terms introduced by reification.
* @group Symbols
* @template
*/
- type FreeTermSymbol >: Null <: TermSymbol with FreeTermSymbolApi
+ type FreeTermSymbol >: Null <: FreeTermSymbolApi with TermSymbol
/** The type of free types introduced by reification.
* @group Symbols
* @template
*/
- type FreeTypeSymbol >: Null <: TypeSymbol with FreeTypeSymbolApi
+ type FreeTypeSymbol >: Null <: FreeTypeSymbolApi with TypeSymbol
/** A special "missing" symbol. Commonly used in the API to denote a default or empty value.
* @group Symbols
diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala
index 60e00ca5fd..95d9d84597 100644
--- a/src/reflect/scala/reflect/api/Trees.scala
+++ b/src/reflect/scala/reflect/api/Trees.scala
@@ -59,7 +59,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Tree >: Null <: TreeApi
+ type Tree >: Null <: AnyRef with TreeApi
/** The API that all trees support.
* The main source of information about trees is the [[scala.reflect.api.Trees]] page.
@@ -216,7 +216,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TermTree >: Null <: AnyRef with Tree with TermTreeApi
+ type TermTree >: Null <: TermTreeApi with Tree
/** The API that all term trees support
* @group API
@@ -229,7 +229,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TypTree >: Null <: AnyRef with Tree with TypTreeApi
+ type TypTree >: Null <: TypTreeApi with Tree
/** The API that all typ trees support
* @group API
@@ -241,7 +241,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type SymTree >: Null <: AnyRef with Tree with SymTreeApi
+ type SymTree >: Null <: SymTreeApi with Tree
/** The API that all sym trees support
* @group API
@@ -255,7 +255,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type NameTree >: Null <: AnyRef with Tree with NameTreeApi
+ type NameTree >: Null <: NameTreeApi with Tree
/** The API that all name trees support
* @group API
@@ -273,7 +273,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type RefTree >: Null <: SymTree with NameTree with RefTreeApi
+ type RefTree >: Null <: RefTreeApi with SymTree with NameTree
/** The API that all ref trees support
* @group API
@@ -307,7 +307,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type DefTree >: Null <: SymTree with NameTree with DefTreeApi
+ type DefTree >: Null <: DefTreeApi with SymTree with NameTree
/** The API that all def trees support
* @group API
@@ -322,7 +322,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type MemberDef >: Null <: DefTree with MemberDefApi
+ type MemberDef >: Null <: MemberDefApi with DefTree
/** The API that all member defs support
* @group API
@@ -336,7 +336,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type PackageDef >: Null <: MemberDef with PackageDefApi
+ type PackageDef >: Null <: PackageDefApi with MemberDef
/** The constructor/extractor for `PackageDef` instances.
* @group Extractors
@@ -369,7 +369,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ImplDef >: Null <: MemberDef with ImplDefApi
+ type ImplDef >: Null <: ImplDefApi with MemberDef
/** The API that all impl defs support
* @group API
@@ -383,7 +383,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ClassDef >: Null <: ImplDef with ClassDefApi
+ type ClassDef >: Null <: ClassDefApi with ImplDef
/** The constructor/extractor for `ClassDef` instances.
* @group Extractors
@@ -428,7 +428,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ModuleDef >: Null <: ImplDef with ModuleDefApi
+ type ModuleDef >: Null <: ModuleDefApi with ImplDef
/** The constructor/extractor for `ModuleDef` instances.
* @group Extractors
@@ -468,7 +468,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ValOrDefDef >: Null <: MemberDef with ValOrDefDefApi
+ type ValOrDefDef >: Null <: ValOrDefDefApi with MemberDef
/** The API that all val defs and def defs support
* @group API
@@ -499,7 +499,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ValDef >: Null <: ValOrDefDef with ValDefApi
+ type ValDef >: Null <: ValDefApi with ValOrDefDef
/** The constructor/extractor for `ValDef` instances.
* @group Extractors
@@ -548,7 +548,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type DefDef >: Null <: ValOrDefDef with DefDefApi
+ type DefDef >: Null <: DefDefApi with ValOrDefDef
/** The constructor/extractor for `DefDef` instances.
* @group Extractors
@@ -597,7 +597,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TypeDef >: Null <: MemberDef with TypeDefApi
+ type TypeDef >: Null <: TypeDefApi with MemberDef
/** The constructor/extractor for `TypeDef` instances.
* @group Extractors
@@ -656,7 +656,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type LabelDef >: Null <: DefTree with TermTree with LabelDefApi
+ type LabelDef >: Null <: LabelDefApi with DefTree with TermTree
/** The constructor/extractor for `LabelDef` instances.
* @group Extractors
@@ -758,7 +758,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Import >: Null <: SymTree with ImportApi
+ type Import >: Null <: ImportApi with SymTree
/** The constructor/extractor for `Import` instances.
* @group Extractors
@@ -810,7 +810,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Template >: Null <: SymTree with TemplateApi
+ type Template >: Null <: TemplateApi with SymTree
/** The constructor/extractor for `Template` instances.
* @group Extractors
@@ -862,7 +862,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Block >: Null <: TermTree with BlockApi
+ type Block >: Null <: BlockApi with TermTree
/** The constructor/extractor for `Block` instances.
* @group Extractors
@@ -901,7 +901,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type CaseDef >: Null <: AnyRef with Tree with CaseDefApi
+ type CaseDef >: Null <: CaseDefApi with Tree
/** The constructor/extractor for `CaseDef` instances.
* @group Extractors
@@ -948,7 +948,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Alternative >: Null <: TermTree with AlternativeApi
+ type Alternative >: Null <: AlternativeApi with TermTree
/** The constructor/extractor for `Alternative` instances.
* @group Extractors
@@ -980,7 +980,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Star >: Null <: TermTree with StarApi
+ type Star >: Null <: StarApi with TermTree
/** The constructor/extractor for `Star` instances.
* @group Extractors
@@ -1015,7 +1015,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Bind >: Null <: DefTree with BindApi
+ type Bind >: Null <: BindApi with DefTree
/** The constructor/extractor for `Bind` instances.
* @group Extractors
@@ -1078,7 +1078,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type UnApply >: Null <: TermTree with UnApplyApi
+ type UnApply >: Null <: UnApplyApi with TermTree
/** The constructor/extractor for `UnApply` instances.
* @group Extractors
@@ -1114,7 +1114,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Function >: Null <: TermTree with SymTree with FunctionApi
+ type Function >: Null <: FunctionApi with TermTree with SymTree
/** The constructor/extractor for `Function` instances.
* @group Extractors
@@ -1152,7 +1152,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Assign >: Null <: TermTree with AssignApi
+ type Assign >: Null <: AssignApi with TermTree
/** The constructor/extractor for `Assign` instances.
* @group Extractors
@@ -1188,7 +1188,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type AssignOrNamedArg >: Null <: TermTree with AssignOrNamedArgApi
+ type AssignOrNamedArg >: Null <: AssignOrNamedArgApi with TermTree
/** The constructor/extractor for `AssignOrNamedArg` instances.
* @group Extractors
@@ -1229,7 +1229,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type If >: Null <: TermTree with IfApi
+ type If >: Null <: IfApi with TermTree
/** The constructor/extractor for `If` instances.
* @group Extractors
@@ -1280,7 +1280,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Match >: Null <: TermTree with MatchApi
+ type Match >: Null <: MatchApi with TermTree
/** The constructor/extractor for `Match` instances.
* @group Extractors
@@ -1315,7 +1315,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Return >: Null <: TermTree with SymTree with ReturnApi
+ type Return >: Null <: ReturnApi with SymTree with TermTree
/** The constructor/extractor for `Return` instances.
* @group Extractors
@@ -1347,7 +1347,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Try >: Null <: TermTree with TryApi
+ type Try >: Null <: TryApi with TermTree
/** The constructor/extractor for `Try` instances.
* @group Extractors
@@ -1385,7 +1385,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Throw >: Null <: TermTree with ThrowApi
+ type Throw >: Null <: ThrowApi with TermTree
/** The constructor/extractor for `Throw` instances.
* @group Extractors
@@ -1415,7 +1415,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type New >: Null <: TermTree with NewApi
+ type New >: Null <: NewApi with TermTree
/** The constructor/extractor for `New` instances.
* @group Extractors
@@ -1465,7 +1465,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Typed >: Null <: TermTree with TypedApi
+ type Typed >: Null <: TypedApi with TermTree
/** The constructor/extractor for `Typed` instances.
* @group Extractors
@@ -1498,7 +1498,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type GenericApply >: Null <: TermTree with GenericApplyApi
+ type GenericApply >: Null <: GenericApplyApi with TermTree
/** The API that all applies support
* @group API
@@ -1519,7 +1519,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TypeApply >: Null <: GenericApply with TypeApplyApi
+ type TypeApply >: Null <: TypeApplyApi with GenericApply
/** The constructor/extractor for `TypeApply` instances.
* @group Extractors
@@ -1557,7 +1557,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Apply >: Null <: GenericApply with ApplyApi
+ type Apply >: Null <: ApplyApi with GenericApply
/** The constructor/extractor for `Apply` instances.
* @group Extractors
@@ -1594,7 +1594,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Super >: Null <: TermTree with SuperApi
+ type Super >: Null <: SuperApi with TermTree
/** The constructor/extractor for `Super` instances.
* @group Extractors
@@ -1640,7 +1640,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type This >: Null <: TermTree with SymTree with ThisApi
+ type This >: Null <: ThisApi with TermTree with SymTree
/** The constructor/extractor for `This` instances.
* @group Extractors
@@ -1675,7 +1675,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Select >: Null <: RefTree with SelectApi
+ type Select >: Null <: SelectApi with RefTree
/** The constructor/extractor for `Select` instances.
* @group Extractors
@@ -1714,7 +1714,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Ident >: Null <: RefTree with IdentApi
+ type Ident >: Null <: IdentApi with RefTree
/** The constructor/extractor for `Ident` instances.
* @group Extractors
@@ -1753,7 +1753,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ReferenceToBoxed >: Null <: TermTree with ReferenceToBoxedApi
+ type ReferenceToBoxed >: Null <: ReferenceToBoxedApi with TermTree
/** The constructor/extractor for `ReferenceToBoxed` instances.
* @group Extractors
@@ -1797,7 +1797,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Literal >: Null <: TermTree with LiteralApi
+ type Literal >: Null <: LiteralApi with TermTree
/** The constructor/extractor for `Literal` instances.
* @group Extractors
@@ -1830,7 +1830,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type Annotated >: Null <: AnyRef with Tree with AnnotatedApi
+ type Annotated >: Null <: AnnotatedApi with Tree
/** The constructor/extractor for `Annotated` instances.
* @group Extractors
@@ -1864,7 +1864,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type SingletonTypeTree >: Null <: TypTree with SingletonTypeTreeApi
+ type SingletonTypeTree >: Null <: SingletonTypeTreeApi with TypTree
/** The constructor/extractor for `SingletonTypeTree` instances.
* @group Extractors
@@ -1894,7 +1894,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type SelectFromTypeTree >: Null <: TypTree with RefTree with SelectFromTypeTreeApi
+ type SelectFromTypeTree >: Null <: SelectFromTypeTreeApi with TypTree with RefTree
/** The constructor/extractor for `SelectFromTypeTree` instances.
* @group Extractors
@@ -1935,7 +1935,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type CompoundTypeTree >: Null <: TypTree with CompoundTypeTreeApi
+ type CompoundTypeTree >: Null <: CompoundTypeTreeApi with TypTree
/** The constructor/extractor for `CompoundTypeTree` instances.
* @group Extractors
@@ -1965,7 +1965,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type AppliedTypeTree >: Null <: TypTree with AppliedTypeTreeApi
+ type AppliedTypeTree >: Null <: AppliedTypeTreeApi with TypTree
/** The constructor/extractor for `AppliedTypeTree` instances.
* @group Extractors
@@ -2007,7 +2007,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TypeBoundsTree >: Null <: TypTree with TypeBoundsTreeApi
+ type TypeBoundsTree >: Null <: TypeBoundsTreeApi with TypTree
/** The constructor/extractor for `TypeBoundsTree` instances.
* @group Extractors
@@ -2044,7 +2044,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type ExistentialTypeTree >: Null <: TypTree with ExistentialTypeTreeApi
+ type ExistentialTypeTree >: Null <: ExistentialTypeTreeApi with TypTree
/** The constructor/extractor for `ExistentialTypeTree` instances.
* @group Extractors
@@ -2085,7 +2085,7 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
- type TypeTree >: Null <: TypTree with TypeTreeApi
+ type TypeTree >: Null <: TypeTreeApi with TypTree
/** The constructor/extractor for `TypeTree` instances.
* @group Extractors
@@ -2313,7 +2313,7 @@ trait Trees { self: Universe =>
* @template
* @group Copying
*/
- type TreeCopier <: TreeCopierOps
+ type TreeCopier >: Null <: AnyRef with TreeCopierOps
/** The standard (lazy) tree copier.
* @group Copying
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
diff --git a/src/reflect/scala/reflect/internal/AnnotationInfos.scala b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
index d634034fe9..f42e0c44c9 100644
--- a/src/reflect/scala/reflect/internal/AnnotationInfos.scala
+++ b/src/reflect/scala/reflect/internal/AnnotationInfos.scala
@@ -75,7 +75,7 @@ trait AnnotationInfos extends api.Annotations { self: SymbolTable =>
* - arrays of constants
* - or nested classfile annotations
*/
- sealed abstract class ClassfileAnnotArg extends Product
+ sealed abstract class ClassfileAnnotArg extends Product with JavaArgumentApi
implicit val JavaArgumentTag = ClassTag[ClassfileAnnotArg](classOf[ClassfileAnnotArg])
case object UnmappableAnnotArg extends ClassfileAnnotArg
diff --git a/src/reflect/scala/reflect/internal/Names.scala b/src/reflect/scala/reflect/internal/Names.scala
index 73ce59feb2..ae9f2da4e5 100644
--- a/src/reflect/scala/reflect/internal/Names.scala
+++ b/src/reflect/scala/reflect/internal/Names.scala
@@ -535,7 +535,7 @@ trait Names extends api.Names {
}
// SYNCNOTE: caller to constructor must synchronize if `synchronizeNames` is enabled
- sealed abstract class TermName(index0: Int, len0: Int, hash: Int) extends Name(index0, len0) {
+ sealed abstract class TermName(index0: Int, len0: Int, hash: Int) extends Name(index0, len0) with TermNameApi {
type ThisNameType = TermName
protected[this] def thisName: TermName = this
val next: TermName = termHashtable(hash)
@@ -572,7 +572,7 @@ trait Names extends api.Names {
def unapply(name: TermName): Option[String] = Some(name.toString)
}
- sealed abstract class TypeName(index0: Int, len0: Int, hash: Int) extends Name(index0, len0) {
+ sealed abstract class TypeName(index0: Int, len0: Int, hash: Int) extends Name(index0, len0) with TypeNameApi {
type ThisNameType = TypeName
protected[this] def thisName: TypeName = this
diff --git a/src/reflect/scala/reflect/internal/Trees.scala b/src/reflect/scala/reflect/internal/Trees.scala
index 125146d9a2..2e35293f4a 100644
--- a/src/reflect/scala/reflect/internal/Trees.scala
+++ b/src/reflect/scala/reflect/internal/Trees.scala
@@ -597,7 +597,7 @@ trait Trees extends api.Trees {
def TypeBoundsTree(bounds: TypeBounds): TypeBoundsTree = TypeBoundsTree(TypeTree(bounds.lo), TypeTree(bounds.hi))
def TypeBoundsTree(sym: Symbol): TypeBoundsTree = atPos(sym.pos)(TypeBoundsTree(sym.info.bounds))
- override type TreeCopier <: InternalTreeCopierOps
+ override type TreeCopier >: Null <: InternalTreeCopierOps
abstract class InternalTreeCopierOps extends TreeCopierOps {
def ApplyDynamic(tree: Tree, qual: Tree, args: List[Tree]): ApplyDynamic
def ArrayValue(tree: Tree, elemtpt: Tree, trees: List[Tree]): ArrayValue
diff --git a/src/reflect/scala/reflect/internal/Types.scala b/src/reflect/scala/reflect/internal/Types.scala
index cf405ade03..d8c7682910 100644
--- a/src/reflect/scala/reflect/internal/Types.scala
+++ b/src/reflect/scala/reflect/internal/Types.scala
@@ -1055,7 +1055,7 @@ trait Types
/** A base class for types that represent a single value
* (single-types and this-types).
*/
- abstract class SingletonType extends SubType with SimpleTypeProxy {
+ abstract class SingletonType extends SubType with SimpleTypeProxy with SingletonTypeApi {
def supertype = underlying
override def isTrivial = false
override def widen: Type = underlying.widen
@@ -1323,7 +1323,7 @@ trait Types
/** A common base class for intersection types and class types
*/
- abstract class CompoundType extends Type {
+ abstract class CompoundType extends Type with CompoundTypeApi {
private[reflect] var baseTypeSeqCache: BaseTypeSeq = _
private[reflect] var baseTypeSeqPeriod = NoPeriod