summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-12-06 23:00:07 +0100
committerEugene Burmako <xeno.by@gmail.com>2012-12-06 23:00:07 +0100
commitd54776074e4e207dab1cbadb30ec04ec7ad93dc9 (patch)
treee014a5fa6978db03cd4cbb85374903b6d3c3a697 /src/reflect
parent5546a72f35e1301d38e3fd56873db7a1fc5163bb (diff)
downloadscala-d54776074e4e207dab1cbadb30ec04ec7ad93dc9.tar.gz
scala-d54776074e4e207dab1cbadb30ec04ec7ad93dc9.tar.bz2
scala-d54776074e4e207dab1cbadb30ec04ec7ad93dc9.zip
TypeApply + Select and their type-level twins
Documented differences between TypeApply and AppliedTypeTree and between Select and SelectFromTypeTree.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/api/Trees.scala32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/api/Trees.scala b/src/reflect/scala/reflect/api/Trees.scala
index c547a1e467..0937a93738 100644
--- a/src/reflect/scala/reflect/api/Trees.scala
+++ b/src/reflect/scala/reflect/api/Trees.scala
@@ -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 {
@@ -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 {
@@ -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.
@@ -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 {
@@ -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 {