Browse files

Fixes SI-6558: typecheck lazy annotation info using non-silent context.

Make context for typing lazy annotations always non-silent. If lazy annotation info was created in local (silent) context, error could go unnoticed because later they would still use silent typer for typing the annotation.
  • Loading branch information...
1 parent f16f4ab commit d9928d59f9b21265f783fe781ad1d3a4ff93bb6e @hubertp hubertp committed with retronym Oct 25, 2012
View
6 src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1260,7 +1260,11 @@ trait Namers extends MethodSynthesis {
case defn: MemberDef =>
val ainfos = defn.mods.annotations filterNot (_ eq null) map { ann =>
// need to be lazy, #1782. beforeTyper to allow inferView in annotation args, SI-5892.
- AnnotationInfo lazily beforeTyper(typer typedAnnotation ann)
+ AnnotationInfo lazily {
+ val context1 = typer.context.make(ann)
+ context1.setReportErrors()
+ beforeTyper(newTyper(context1) typedAnnotation ann)
+ }
}
if (ainfos.nonEmpty) {
annotated setAnnotations ainfos
View
4 test/files/neg/t6558.check
@@ -0,0 +1,4 @@
+t6558.scala:5: error: not found: type sth
+ @sth
+ ^
+one error found
View
9 test/files/neg/t6558.scala
@@ -0,0 +1,9 @@
+class AnnotNotFound {
+ def foo(a: Any) = ()
+
+ foo {
+ @sth
+ def foo = 0
+ foo
+ }
+}

0 comments on commit d9928d5

Please sign in to comment.