@@ -216,8 +216,8 @@ object Contexts {
216
216
else if (isNonEmptyScopeContext) scope.implicitDecls
217
217
else Nil
218
218
val outerImplicits =
219
- if (isImportContext && importInfo.hiddenRoot .exists)
220
- outer.implicits exclude importInfo.hiddenRoot
219
+ if (isImportContext && importInfo.unimported .exists)
220
+ outer.implicits exclude importInfo.unimported
221
221
else
222
222
outer.implicits
223
223
if (implicitRefs.isEmpty) outerImplicits
@@ -422,9 +422,18 @@ object Contexts {
422
422
final def withOwner (owner : Symbol ): Context =
423
423
if (owner ne this .owner) fresh.setOwner(owner) else this
424
424
425
- override def toString =
425
+ final def withProperty [T ](key : Key [T ], value : Option [T ]): Context =
426
+ if (property(key) == value) this
427
+ else value match {
428
+ case Some (v) => fresh.setProperty(key, v)
429
+ case None => fresh.dropProperty(key)
430
+ }
431
+
432
+ override def toString = {
433
+ def iinfo (implicit ctx : Context ) = if (ctx.importInfo == null ) " " else i " ${ctx.importInfo.selectors}%, % "
426
434
" Context(\n " +
427
- (outersIterator map ( ctx => s " owner = ${ctx.owner}, scope = ${ctx.scope}" ) mkString " \n " )
435
+ (outersIterator map ( ctx => s " owner = ${ctx.owner}, scope = ${ctx.scope}, import = ${iinfo(ctx)}" ) mkString " \n " )
436
+ }
428
437
}
429
438
430
439
/** A condensed context provides only a small memory footprint over
@@ -468,6 +477,9 @@ object Contexts {
468
477
def setProperty [T ](key : Key [T ], value : T ): this .type =
469
478
setMoreProperties(moreProperties.updated(key, value))
470
479
480
+ def dropProperty (key : Key [_]): this .type =
481
+ setMoreProperties(moreProperties - key)
482
+
471
483
def setPhase (pid : PhaseId ): this .type = setPeriod(Period (runId, pid))
472
484
def setPhase (phase : Phase ): this .type = setPeriod(Period (runId, phase.start, phase.end))
473
485
0 commit comments