diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala | 17 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 5 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala index 0aa228062e..2b89f295d4 100644 --- a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala +++ b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala @@ -33,23 +33,14 @@ trait AnnotationInfos { * converted into a compile-time Constant. Used to pickle Literals * as Constants */ - val constant = { - def lit2cons(t: Tree): Option[Constant] = t match { - case Literal(c) => Some(c) - // case Typed(t, _) => lit2cons(t) - // disabling this: in the expression "3: @ann", the annotation gets lost. - case _ => None - } - lit2cons(intTree) + val constant = intTree match { + case Literal(c) => Some(c) + case _ => None } def isConstant = !constant.isEmpty - override def toString: String = - constant match { - case Some(cons) => cons.escapedStringValue - case None => intTree.toString - } + override def toString = intTree.toString } /** Subclasses of this class are used to represent Arguments diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 477c69cad2..626dbe00bd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1054,6 +1054,11 @@ trait Namers { self: Analyzer => val sym: Symbol = tree.symbol // For definitions, transform Annotation trees to AnnotationInfos, assign // them to the sym's annotations. Type annotations: see Typer.typedAnnotated + + // We have to parse definition annotatinos here (not in the typer when traversing + // the MemberDef tree): the typer looks at annotations of certain symbols; if + // they were added only in typer, depending on the compilation order, they would + // be visible or not val annotated = if (sym.isModule) sym.moduleClass else sym if (annotated.annotations.isEmpty) tree match { case defn: MemberDef => |