summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-12 15:38:04 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-12 15:38:04 +0000
commitedacf9f4340f6eefe48852cbb2c9535d38275ac2 (patch)
treee14242b598e9f187a179f1c67c7886dce5e6508e /src
parentc2c439dc6d905a675602258644a6365f8d131a68 (diff)
downloadscala-edacf9f4340f6eefe48852cbb2c9535d38275ac2.tar.gz
scala-edacf9f4340f6eefe48852cbb2c9535d38275ac2.tar.bz2
scala-edacf9f4340f6eefe48852cbb2c9535d38275ac2.zip
- added method Type.attributes
- commented two odd-looking methods
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/Types.scala13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Types.scala b/src/compiler/scala/tools/nsc/symtab/Types.scala
index 52268c7ab3..f09d2b7275 100644
--- a/src/compiler/scala/tools/nsc/symtab/Types.scala
+++ b/src/compiler/scala/tools/nsc/symtab/Types.scala
@@ -639,6 +639,9 @@ trait Types {
}
}
+ /** Return the attributes on this type */
+ val attributes: List[AnnotationInfo] = Nil
+
/** Add an attribute to this type */
def withAttribute(attrib: AnnotationInfo) = withAttributes(List(attrib))
@@ -1566,7 +1569,7 @@ A type's typeSymbol should never be inspected directly.
* to the core compiler, but can be observed by type-system plugins. The
* core compiler does take care to propagate attributes and to save them
* in the symbol tables of object files. */
- case class AnnotatedType(attributes: List[AnnotationInfo], tp: Type) extends TypeProxy {
+ case class AnnotatedType(override val attributes: List[AnnotationInfo], tp: Type) extends TypeProxy {
override protected def rewrap(tp: Type) = AnnotatedType(attributes, tp)
@@ -1588,7 +1591,8 @@ A type's typeSymbol should never be inspected directly.
/** Remove any attributes from this type */
override def withoutAttributes = tp.withoutAttributes
- /** Martin to Lex: I don't understand what the following 2 methods do? */
+ /** Drop the annotations on the bounds, unless but the low and high bounds are
+ * exactly tp. */
override def bounds: TypeBounds = {
val oftp = tp.bounds
oftp match {
@@ -1596,9 +1600,12 @@ A type's typeSymbol should never be inspected directly.
case _ => oftp
}
}
+
+ /** Return the closure of tp, dropping the annotations, unless the closure of tp
+ * is precisely tp itself. */
override def closure: Array[Type] = {
val oftp = tp.closure
- if ((oftp.length == 1 &&) (oftp(0) eq this))
+ if ((oftp.length == 1 &&) (oftp(0) eq tp))
Array(this)
else
oftp