summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-12-31 19:20:18 +0000
committerLex Spoon <lex@lexspoon.org>2007-12-31 19:20:18 +0000
commit50f39cd160990052163b47729fe1cf91f7ce95c6 (patch)
treef2e20d223316a67035f7a3014a466f2ee2005e2f
parent319dda9041450a7279c2e6f4b01b80bcd2ba8e84 (diff)
downloadscala-50f39cd160990052163b47729fe1cf91f7ce95c6.tar.gz
scala-50f39cd160990052163b47729fe1cf91f7ce95c6.tar.bz2
scala-50f39cd160990052163b47729fe1cf91f7ce95c6.zip
Be careful of the mode when typing annotations.
TERMmode and not TYPEmode.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 4543111fba..dd8618e0ae 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2100,6 +2100,9 @@ trait Typers { self: Analyzer =>
}
def typedAnnotated(annot: Annotation, arg1: Tree): Tree = {
+ /** mode for typing the annotation itself */
+ val annotMode = mode & ~TYPEmode | EXPRmode
+
if (arg1.isType) {
val selfsym =
if (!settings.selfInAnnots.value)
@@ -2127,7 +2130,7 @@ trait Typers { self: Analyzer =>
case sym => sym
}
- val ainfo = typedAnnotation(annot, selfsym, mode)
+ val ainfo = typedAnnotation(annot, selfsym, annotMode)
val atype0 = arg1.tpe.withAttribute(ainfo)
val atype =
if ((selfsym != NoSymbol) && (ainfo.refsSymbol(selfsym)))
@@ -2144,7 +2147,7 @@ trait Typers { self: Analyzer =>
def annotTypeTree(ainfo: AnnotationInfo): Tree =
TypeTree(arg1.tpe.withAttribute(ainfo)) setOriginal tree
- val annotInfo = typedAnnotation(annot, mode)
+ val annotInfo = typedAnnotation(annot, annotMode)
arg1 match {
case _: DefTree =>