aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-11-10 14:20:24 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-01 13:55:12 +0100
commit4f15dfa93d8ea1c1066b73be9ba396e7f16af481 (patch)
tree64ff657a15713cd01c547a26815144061192cbc8 /compiler/src/dotty/tools/dotc/core
parent2b12868070be50fb70c687bcd8a415acbe398e3e (diff)
downloaddotty-4f15dfa93d8ea1c1066b73be9ba396e7f16af481.tar.gz
dotty-4f15dfa93d8ea1c1066b73be9ba396e7f16af481.tar.bz2
dotty-4f15dfa93d8ea1c1066b73be9ba396e7f16af481.zip
Fix #1647 Evaluate annotation arguments in proper context
Need to evaluate annotation arguments in an expression context, since classes defined in asuch arguments should not be entered into enclosing class. Fixes #1647
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Contexts.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Contexts.scala b/compiler/src/dotty/tools/dotc/core/Contexts.scala
index 909cebcc7..a1b99d16d 100644
--- a/compiler/src/dotty/tools/dotc/core/Contexts.scala
+++ b/compiler/src/dotty/tools/dotc/core/Contexts.scala
@@ -422,6 +422,13 @@ object Contexts {
final def withOwner(owner: Symbol): Context =
if (owner ne this.owner) fresh.setOwner(owner) else this
+ final def withProperty[T](key: Key[T], value: Option[T]): Context =
+ if (property(key) == value) this
+ else value match {
+ case Some(v) => fresh.setProperty(key, v)
+ case None => fresh.dropProperty(key)
+ }
+
override def toString = {
def iinfo(implicit ctx: Context) = if (ctx.importInfo == null) "" else i"${ctx.importInfo.selectors}%, %"
"Context(\n" +
@@ -470,6 +477,9 @@ object Contexts {
def setProperty[T](key: Key[T], value: T): this.type =
setMoreProperties(moreProperties.updated(key, value))
+ def dropProperty(key: Key[_]): this.type =
+ setMoreProperties(moreProperties - key)
+
def setPhase(pid: PhaseId): this.type = setPeriod(Period(runId, pid))
def setPhase(phase: Phase): this.type = setPeriod(Period(runId, phase.start, phase.end))