summaryrefslogtreecommitdiff
path: root/src/library/scala/reflect/api/Symbols.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-04-12 01:59:46 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-04-12 02:04:14 +0200
commit814cf34fb00f9ccb001249f4b3445ebc4f9942c9 (patch)
tree24dd54da571d27f10b0c482a6e08932c318fd7b2 /src/library/scala/reflect/api/Symbols.scala
parentdb3056f11730da19e4e56f09f12e300bda62f57c (diff)
downloadscala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.tar.gz
scala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.tar.bz2
scala-814cf34fb00f9ccb001249f4b3445ebc4f9942c9.zip
Next generation of macros
Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ Features: * Macro defs * Reification * Type tags * Manifests aliased to type tags * Extended reflection API * Several hundred tests * 1111 changed files Not yet implemented: * Reification of refined types * Expr.value splicing * Named and default macro expansions * Intricacies of interaction between macros and implicits * Emission of debug information for macros (compliant with JSR-45) Dedicated to Yuri Alekseyevich Gagarin
Diffstat (limited to 'src/library/scala/reflect/api/Symbols.scala')
-rwxr-xr-xsrc/library/scala/reflect/api/Symbols.scala61
1 files changed, 58 insertions, 3 deletions
diff --git a/src/library/scala/reflect/api/Symbols.scala b/src/library/scala/reflect/api/Symbols.scala
index ab59a4a39a..a154e5f7a0 100755
--- a/src/library/scala/reflect/api/Symbols.scala
+++ b/src/library/scala/reflect/api/Symbols.scala
@@ -7,6 +7,10 @@ trait Symbols { self: Universe =>
abstract class AbsSymbol { this: Symbol =>
+ /** The position of this symbol
+ */
+ def pos: Position
+
/** The modifiers of this symbol
*/
def modifiers: Set[Modifier]
@@ -47,6 +51,10 @@ trait Symbols { self: Universe =>
/** An id number which is unique for all symbols in this universe */
def id: Int
+ /** ...
+ */
+ def orElse[T](alt: => Symbol): Symbol
+
/**
* Set when symbol has a modifier of the form private[X], NoSymbol otherwise.
*
@@ -112,6 +120,20 @@ trait Symbols { self: Universe =>
*/
def isTerm : Boolean
+ /** Does this symbol represent the definition of method?
+ * If yes, `isTerm` is also guaranteed to be true.
+ */
+ def isMethod : Boolean
+
+ /** Is this symbol an overloaded method?
+ */
+ def isOverloaded : Boolean
+
+ /** Does this symbol represent a free term captured by reification?
+ */
+ // needed for ones who wish to inspect reified trees
+ def isFreeTerm : Boolean
+
/** Does this symbol represent the definition of type?
* Note that every symbol is either a term or a type.
* So for every symbol `sym`, either `sym.isTerm` is true
@@ -124,6 +146,17 @@ trait Symbols { self: Universe =>
*/
def isClass : Boolean
+ /** Does this symbol represent the definition of a primitive class?
+ * Namely, is it one of [[scala.Double]], [[scala.Float]], [[scala.Long]], [[scala.Int]], [[scala.Char]],
+ * [[scala.Short]], [[scala.Byte]], [[scala.Unit]] or [[scala.Boolean]]?
+ */
+ def isPrimitiveValueClass: Boolean
+
+ /** Does this symbol represent the definition of a custom value class?
+ * Namely, is AnyVal among its parent classes?
+ */
+ def isDerivedValueClass: Boolean
+
/** Does this symbol represent the definition of a type alias?
* If yes, `isType` is also guaranteed to be true.
*/
@@ -134,9 +167,28 @@ trait Symbols { self: Universe =>
*/
def isAbstractType : Boolean
- /** Is this symbol an overloaded method?
+ /** Does this symbol represent the definition of a skolem?
+ * Skolems are used during typechecking to represent type parameters viewed from inside their scopes.
+ * If yes, `isType` is also guaranteed to be true.
*/
- def isOverloaded: Boolean
+ def isSkolem : Boolean
+
+ /** Does this symbol represent a free type captured by reification?
+ */
+ // needed for ones who wish to inspect reified trees
+ def isFreeType : Boolean
+
+ /** Is the type parameter represented by this symbol contravariant?
+ */
+ def isContravariant : Boolean
+
+ /** Is the type parameter represented by this symbol contravariant?
+ */
+ def isCovariant : Boolean
+
+ /** Does this symbol or its underlying type represent a typechecking error?
+ */
+ def isErroneous : Boolean
/** The type signature of this symbol.
* Note if the symbol is a member of a class, one almost always is interested
@@ -192,7 +244,7 @@ trait Symbols { self: Universe =>
/** A fresh symbol with given name `name`, position `pos` and flags `flags` that has
* the current symbol as its owner.
*/
- def newNestedSymbol(name: Name, pos: Position, flags: Long, isClass: Boolean): Symbol // needed by LiftCode
+ def newNestedSymbol(name: Name, pos: Position, flags: Long, isClass: Boolean): Symbol // needed by LiftCode !!! not enough reason to have in the api
/** Low-level operation to set the symbol's flags
* @return the symbol itself
@@ -207,6 +259,9 @@ trait Symbols { self: Universe =>
/** Set symbol's annotations to given annotations `annots`.
*/
def setAnnotations(annots: AnnotationInfo*): this.type // needed by LiftCode !!! not enough reason to have in the api
+
+ /** The kind of this symbol; used for debugging */
+ def kind: String
}
val NoSymbol: Symbol