diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-06-27 15:39:46 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-06-27 15:39:46 -0700 |
commit | 54cb6af7dbcf630a4f57e98f0099d77dd3b36693 (patch) | |
tree | ca78470b2ee74996690deae6b6e939edee689bd7 /src/compiler | |
parent | 79fd0c69e8b2b4848c924457b2f8ff3b61168a7a (diff) | |
parent | eebaae55bad824a98fdf4a1811809b8776f36825 (diff) | |
download | scala-54cb6af7dbcf630a4f57e98f0099d77dd3b36693.tar.gz scala-54cb6af7dbcf630a4f57e98f0099d77dd3b36693.tar.bz2 scala-54cb6af7dbcf630a4f57e98f0099d77dd3b36693.zip |
Merge pull request #2680 from retronym/ticket/7603
SI-7603 Speculative fix for annotation binding error
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 379f56521b..8f542af417 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1420,11 +1420,20 @@ trait Namers extends MethodSynthesis { if (!annotated.isInitialized) tree match { case defn: MemberDef => val ainfos = defn.mods.annotations filterNot (_ eq null) map { ann => + val ctx = typer.context + val annCtx = ctx.make(ann) + annCtx.setReportErrors() // need to be lazy, #1782. beforeTyper to allow inferView in annotation args, SI-5892. AnnotationInfo lazily { - val context1 = typer.context.make(ann) - context1.setReportErrors() - beforeTyper(newTyper(context1) typedAnnotation ann) + if (typer.context ne ctx) + log(sm"""|The var `typer.context` in ${Namer.this} was mutated before the annotation ${ann} was forced. + | + |current value = ${typer.context} + |original value = $ctx + | + |This confirms the hypothesis for the cause of SI-7603. If you see this message, please comment on that ticket.""") + + beforeTyper(newTyper(annCtx) typedAnnotation ann) } } if (ainfos.nonEmpty) { |