@@ -162,25 +162,24 @@ object Contexts {
162
162
_typeComparer
163
163
}
164
164
165
- /** Is this context transparent ? */
165
+ /** Is this context dependent ? */
166
166
private [this ] var _dependentInit : Boolean = true // NOTE: This initial value only applies to InitialContext
167
167
private [this ] var _dependent : Boolean = false
168
168
final def isDependent : Boolean = {
169
+ def isDepOwner (owner : Symbol ): Boolean =
170
+ if ((owner eq NoSymbol ) || owner.isClass) false
171
+ else if (owner.flagsUNSAFE.is(Flags .Dependent )) true
172
+ else isDepOwner(owner.owner)
173
+
169
174
/** NOTE: The initialization of `_dependent` is rather tricky: We do need to make sure that any
170
175
* enclosing context's `_dependent` has been computed, since the property is inherited. In case the
171
- * outer's `transparent ` has been accessed before, we inherit the value by way of clone() in fresh(),
176
+ * outer's `dependent ` has been accessed before, we inherit the value by way of clone() in fresh(),
172
177
* (and as a result `_dependentInit` will be true as well).
173
178
* Otherwise we force the enclosing context's `_dependent` here, and, if the outer turns out not to be
174
- * transparent , we finally also compute `_dependent` based on this context.
179
+ * dependent , we finally also compute `_dependent` based on this context.
175
180
*/
176
181
if (! _dependentInit) {
177
- val S = this .base.settings
178
- _dependent = if (owner eq NoSymbol ) false else
179
- this .mode.is(Mode .InTypeOf ) ||
180
- ! this .owner.isClass && (
181
- outer.isDependent ||
182
- this .owner.flagsUNSAFE.is(Flags .Dependent )
183
- )
182
+ _dependent = this .mode.is(Mode .InTypeOf ) || isDepOwner(this .owner)
184
183
_dependentInit = true
185
184
}
186
185
_dependent
0 commit comments