diff options
author | Martin Odersky <odersky@gmail.com> | 2013-10-04 14:57:57 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-10-04 14:58:08 +0200 |
commit | 9a28428f48e9a8ef8e4ef8f35260a10842736624 (patch) | |
tree | 9ba16d6430207faacb9d6142d9da2fe15f23fecf /src/dotty/tools/dotc/core | |
parent | 7c02b2b3c8b50725b4035658a369d015a2a3b64f (diff) | |
download | dotty-9a28428f48e9a8ef8e4ef8f35260a10842736624.tar.gz dotty-9a28428f48e9a8ef8e4ef8f35260a10842736624.tar.bz2 dotty-9a28428f48e9a8ef8e4ef8f35260a10842736624.zip |
Fixed problem with withMode leaking into enclosing context.
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Contexts.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/core/Contexts.scala b/src/dotty/tools/dotc/core/Contexts.scala index 761f7764e..3110d8fd9 100644 --- a/src/dotty/tools/dotc/core/Contexts.scala +++ b/src/dotty/tools/dotc/core/Contexts.scala @@ -243,7 +243,7 @@ object Contexts { if (_condensed eq outer.condensed) _condensed = base.initialCtx.fresh .withPeriod(period) - .withMode(mode) + .withNewMode(mode) // typerState and its constraint is not preserved in condensed // reporter is always ThrowingReporter .withPrinterFn(printerFn) @@ -265,12 +265,12 @@ object Contexts { newctx } - def withMode(mode: Mode): Context = - if (mode != this.mode) fresh.withMode(mode) else this + final def withMode(mode: Mode): Context = + if (mode != this.mode) fresh.withNewMode(mode) else this - def addMode(mode: Mode): Context = withMode(this.mode | mode) - def maskMode(mode: Mode): Context = withMode(this.mode & mode) - def retractMode(mode: Mode): Context = withMode(this.mode &~ mode) + final def addMode(mode: Mode): Context = withMode(this.mode | mode) + final def maskMode(mode: Mode): Context = withMode(this.mode & mode) + final def retractMode(mode: Mode): Context = withMode(this.mode &~ mode) } /** A condensed context provides only a small memory footprint over @@ -286,7 +286,7 @@ object Contexts { */ abstract class FreshContext extends CondensedContext { def withPeriod(period: Period): this.type = { this.period = period; this } - override def withMode(mode: Mode): this.type = { this.mode = mode; this } + def withNewMode(mode: Mode): this.type = { this.mode = mode; this } def withTyperState(typerState: TyperState): this.type = { this.typerState = typerState; this } def withNewTyperState: this.type = withTyperState(typerState.fresh) def withPrinterFn(printer: Context => Printer): this.type = { this.printerFn = printer; this } |