diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-03-31 14:00:09 +0000 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2010-03-31 14:00:09 +0000 |
commit | 469dc5ebf005e980e26f6122093fd550c15ebb98 (patch) | |
tree | 767f8025e0a16f89c1f93fc8c7d7540c8b46d179 | |
parent | ad036896d8ceff4ada884911140b6d245cfe9204 (diff) | |
download | scala-469dc5ebf005e980e26f6122093fd550c15ebb98.tar.gz scala-469dc5ebf005e980e26f6122093fd550c15ebb98.tar.bz2 scala-469dc5ebf005e980e26f6122093fd550c15ebb98.zip |
close #3222. review by community
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 12 | ||||
-rw-r--r-- | test/files/neg/t3222.check | 13 | ||||
-rw-r--r-- | test/files/neg/t3222.scala | 9 |
4 files changed, 35 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index b36272bd18..a0ababea8a 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -107,7 +107,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => * the annotations attached to member a definition (class, method, type, field). */ def annotations: List[AnnotationInfo] = { - // .initialize: the type completer o f the symbol parses the annotations, + // .initialize: the type completer of the symbol parses the annotations, // see "def typeSig" in Namers val annots1 = initialize.rawannots map { case LazyAnnotationInfo(annot) => annot() diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 916ed2e75e..2a8fcb8a68 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1489,6 +1489,8 @@ trait Typers { self: Analyzer => */ def typedTemplate(templ: Template, parents1: List[Tree]): Template = { val clazz = context.owner + // complete lazy annotations + val annots = clazz.annotations if (templ.symbol == NoSymbol) templ setSymbol clazz.newLocalDummy(templ.pos) val self1 = templ.self match { @@ -1543,6 +1545,9 @@ trait Typers { self: Analyzer => val typer1 = constrTyperIf(sym.hasFlag(PARAM) && sym.owner.isConstructor) val typedMods = removeAnnotations(vdef.mods) + // complete lazy annotations + val annots = sym.annotations + var tpt1 = checkNoEscaping.privates(sym, typer1.typedType(vdef.tpt)) checkNonCyclic(vdef, tpt1) if (sym.hasAnnotation(definitions.VolatileAttr)) { @@ -1813,6 +1818,9 @@ trait Typers { self: Analyzer => val tparams1 = ddef.tparams mapConserve typedTypeDef val vparamss1 = ddef.vparamss mapConserve (_ mapConserve typedValDef) + // complete lazy annotations + val annots = meth.annotations + for (vparams1 <- vparamss1; vparam1 <- vparams1 dropRight 1) if (isRepeatedParamType(vparam1.symbol.tpe)) error(vparam1.pos, "*-parameter must come last") @@ -1858,6 +1866,8 @@ trait Typers { self: Analyzer => reenterTypeParams(tdef.tparams) // @M! val tparams1 = tdef.tparams mapConserve (typedTypeDef) // @M! val typedMods = removeAnnotations(tdef.mods) + // complete lazy annotations + val annots = tdef.symbol.annotations val rhs1 = checkNoEscaping.privates(tdef.symbol, typedType(tdef.rhs)) checkNonCyclic(tdef.symbol) if (tdef.symbol.owner.isType) @@ -3776,6 +3786,8 @@ trait Typers { self: Analyzer => case PackageDef(pid, stats) => val pid1 = typedQualifier(pid).asInstanceOf[RefTree] assert(sym.moduleClass ne NoSymbol, sym) + // complete lazy annotations + val annots = sym.annotations val stats1 = newTyper(context.make(tree, sym.moduleClass, sym.info.decls)) .typedStats(stats, NoSymbol) treeCopy.PackageDef(tree, pid1, stats1) setType NoType diff --git a/test/files/neg/t3222.check b/test/files/neg/t3222.check new file mode 100644 index 0000000000..6170827cc9 --- /dev/null +++ b/test/files/neg/t3222.check @@ -0,0 +1,13 @@ +t3222.scala:1: error: not found: type B +@throws(classOf[B]) + ^ +t3222.scala:4: error: not found: type D + def foo(@throws(classOf[D]) x: Int) {} + ^ +t3222.scala:3: error: not found: type C + @throws(classOf[C]) + ^ +t3222.scala:6: error: not found: type E + @throws(classOf[E]) + ^ +four errors found diff --git a/test/files/neg/t3222.scala b/test/files/neg/t3222.scala new file mode 100644 index 0000000000..448292e8a7 --- /dev/null +++ b/test/files/neg/t3222.scala @@ -0,0 +1,9 @@ +@throws(classOf[B]) +class ExceptionTest { + @throws(classOf[C]) + def foo(@throws(classOf[D]) x: Int) {} + + @throws(classOf[E]) + type t = String +} + |