Skip to content

Commit

Permalink
TypeApply + Select and their type-level twins
Browse files Browse the repository at this point in the history
Documented differences between TypeApply and AppliedTypeTree and
between Select and SelectFromTypeTree.
  • Loading branch information
xeno-by committed Dec 6, 2012
1 parent 5546a72 commit d547760
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/reflect/scala/reflect/api/Trees.scala
Expand Up @@ -1729,6 +1729,16 @@ trait Trees { self: Universe =>
* This AST node corresponds to the following Scala code:
*
* fun[args]
*
* Should only be used with `fun` nodes which are terms, i.e. which have `isTerm` returning `true`.
* Otherwise `AppliedTypeTree` should be used instead.
*
* def foo[T] = ???
* foo[Int] // represented as TypeApply(Ident(<foo>), List(TypeTree(<Int>)))
*
* List[Int] as in `val x: List[Int] = ???`
* // represented as AppliedTypeTree(Ident(<List>), List(TypeTree(<Int>)))
*
* @group Extractors
*/
abstract class TypeApplyExtractor {
Expand Down Expand Up @@ -1899,6 +1909,12 @@ trait Trees { self: Universe =>
* This AST node corresponds to the following Scala code:
*
* qualifier.selector
*
* Should only be used with `qualifier` nodes which are terms, i.e. which have `isTerm` returning `true`.
* Otherwise `SelectFromTypeTree` should be used instead.
*
* foo.Bar // represented as Select(Ident(<foo>), <Bar>)
* Foo#Bar // represented as SelectFromTypeTree(Ident(<Foo>), <Bar>)
* @group Extractors
*/
abstract class SelectExtractor {
Expand Down Expand Up @@ -2131,7 +2147,6 @@ trait Trees { self: Universe =>
* @group Trees
* @template
*/
// [Eugene++] don't see why we need it, when we have Select
type SelectFromTypeTree >: Null <: TypTree with RefTree with SelectFromTypeTreeApi

/** A tag that preserves the identity of the `SelectFromTypeTree` abstract type from erasure.
Expand All @@ -2151,6 +2166,12 @@ trait Trees { self: Universe =>
* qualifier # selector
*
* Note: a path-dependent type p.T is expressed as p.type # T
*
* Should only be used with `qualifier` nodes which are types, i.e. which have `isType` returning `true`.
* Otherwise `Select` should be used instead.
*
* Foo#Bar // represented as SelectFromTypeTree(Ident(<Foo>), <Bar>)
* foo.Bar // represented as Select(Ident(<foo>), <Bar>)
* @group Extractors
*/
abstract class SelectFromTypeTreeExtractor {
Expand Down Expand Up @@ -2226,6 +2247,15 @@ trait Trees { self: Universe =>
* This AST node corresponds to the following Scala code:
*
* tpt[args]
*
* Should only be used with `tpt` nodes which are types, i.e. which have `isType` returning `true`.
* Otherwise `TypeApply` should be used instead.
*
* List[Int] as in `val x: List[Int] = ???`
* // represented as AppliedTypeTree(Ident(<List>), List(TypeTree(<Int>)))
*
* def foo[T] = ???
* foo[Int] // represented as TypeApply(Ident(<foo>), List(TypeTree(<Int>)))
* @group Extractors
*/
abstract class AppliedTypeTreeExtractor {
Expand Down

0 comments on commit d547760

Please sign in to comment.