@@ -48,7 +48,9 @@ object Contexts {
4848 private val (runLoc, store6) = store5.newLocation[Run ]()
4949 private val (profilerLoc, store7) = store6.newLocation[Profiler ]()
5050 private val (notNullInfosLoc, store8) = store7.newLocation[List [NotNullInfo ]]()
51- private val initialStore = store8
51+ private val (importInfoLoc, store9) = store8.newLocation[ImportInfo ]()
52+
53+ private val initialStore = store9
5254
5355 /** The current context */
5456 inline def ctx (using ctx : Context ): Context = ctx
@@ -156,11 +158,6 @@ object Contexts {
156158 protected def typeAssigner_= (typeAssigner : TypeAssigner ): Unit = _typeAssigner = typeAssigner
157159 final def typeAssigner : TypeAssigner = _typeAssigner
158160
159- /** The currently active import info */
160- private var _importInfo : ImportInfo = _
161- protected def importInfo_= (importInfo : ImportInfo ): Unit = _importInfo = importInfo
162- final def importInfo : ImportInfo = _importInfo
163-
164161 /** The current bounds in force for type parameters appearing in a GADT */
165162 private var _gadt : GadtConstraint = _
166163 protected def gadt_= (gadt : GadtConstraint ): Unit = _gadt = gadt
@@ -230,6 +227,9 @@ object Contexts {
230227 /** The paths currently known to be not null */
231228 def notNullInfos = store(notNullInfosLoc)
232229
230+ /** The currently active import info */
231+ def importInfo = store(importInfoLoc)
232+
233233 /** The new implicit references that are introduced by this scope */
234234 protected var implicitsCache : ContextualImplicits = null
235235 def implicits : ContextualImplicits = {
@@ -351,7 +351,9 @@ object Contexts {
351351
352352 /** Is this a context that introduces an import clause? */
353353 def isImportContext : Boolean =
354- (this ne NoContext ) && (this .importInfo ne outer.importInfo)
354+ (this ne NoContext )
355+ && (outer ne NoContext )
356+ && (this .importInfo ne outer.importInfo)
355357
356358 /** Is this a context that introduces a non-empty scope? */
357359 def isNonEmptyScopeContext : Boolean =
@@ -461,7 +463,6 @@ object Contexts {
461463 _scope = origin.scope
462464 _typerState = origin.typerState
463465 _typeAssigner = origin.typeAssigner
464- _importInfo = origin.importInfo
465466 _gadt = origin.gadt
466467 _searchHistory = origin.searchHistory
467468 _typeComparer = origin.typeComparer
@@ -550,7 +551,6 @@ object Contexts {
550551 def setReporter (reporter : Reporter ): this .type = setTyperState(typerState.fresh().setReporter(reporter))
551552 def setTypeAssigner (typeAssigner : TypeAssigner ): this .type = { this .typeAssigner = typeAssigner; this }
552553 def setTyper (typer : Typer ): this .type = { this .scope = typer.scope; setTypeAssigner(typer) }
553- def setImportInfo (importInfo : ImportInfo ): this .type = { this .importInfo = importInfo; this }
554554 def setGadt (gadt : GadtConstraint ): this .type = { this .gadt = gadt; this }
555555 def setFreshGADTBounds : this .type = setGadt(gadt.fresh)
556556 def setSearchHistory (searchHistory : SearchHistory ): this .type = { this .searchHistory = searchHistory; this }
@@ -572,6 +572,7 @@ object Contexts {
572572 def setRun (run : Run ): this .type = updateStore(runLoc, run)
573573 def setProfiler (profiler : Profiler ): this .type = updateStore(profilerLoc, profiler)
574574 def setNotNullInfos (notNullInfos : List [NotNullInfo ]): this .type = updateStore(notNullInfosLoc, notNullInfos)
575+ def setImportInfo (importInfo : ImportInfo ): this .type = updateStore(importInfoLoc, importInfo)
575576
576577 def setProperty [T ](key : Key [T ], value : T ): this .type =
577578 setMoreProperties(moreProperties.updated(key, value))
0 commit comments