@@ -204,34 +204,48 @@ object SymDenotations {
204
204
if (isCurrent(fs)) myFlags else flags
205
205
206
206
/** Has this denotation one of given flag set? */
207
- final def is (flag : Flag )(implicit ctx : Context ): Boolean =
208
- (if (isCurrent(flag)) myFlags else flags).is(flag)
209
-
210
- /** Has this denotation one of the flags in `fs` set? */
211
- final def isOneOf (fs : FlagSet )(implicit ctx : Context ): Boolean =
212
- (if (isCurrent(fs)) myFlags else flags).isOneOf(fs)
207
+ final inline def is (flag : Flag )(implicit ctx : Context ): Boolean =
208
+ is(flag, EmptyFlags )
213
209
214
210
/** Has this denotation the given flag set, whereas none of the flags
215
211
* in `butNot` are set?
216
212
*/
217
- final def is (flag : Flag , butNot : FlagSet )(implicit ctx : Context ): Boolean =
218
- is(flag) && ! isOneOf(butNot)
213
+ final inline def is (flag : Flag , butNot : FlagSet )(implicit ctx : Context ): Boolean =
214
+ isAllOf(flag, butNot)
215
+
216
+ /** Has this denotation one of the flags in `fs` set? */
217
+ final inline def isOneOf (fs : FlagSet )(implicit ctx : Context ): Boolean =
218
+ isOneOf(fs, EmptyFlags )
219
219
220
220
/** Has this denotation one of the flags in `fs` set, whereas none of the flags
221
221
* in `butNot` are set?
222
222
*/
223
223
final def isOneOf (fs : FlagSet , butNot : FlagSet )(implicit ctx : Context ): Boolean =
224
- isOneOf(fs) && ! isOneOf(butNot)
224
+ val immutable = immutableFlags
225
+ val (fsImmut, fsMut) = fs.partitionByIntersection(immutable)
226
+ val (butNotImmut, butNotMut) = butNot.partitionByIntersection(immutable)
227
+
228
+ (butNotImmut & myFlags).isEmpty &&
229
+ (! (fsImmut & myFlags).isEmpty || (! fsMut.isEmpty && ! (fsMut & flags).isEmpty)) &&
230
+ (butNotMut.isEmpty || (butNotMut & flags).isEmpty)
225
231
226
232
/** Has this denotation all of the flags in `fs` set? */
227
- final def isAllOf (fs : FlagSet )(implicit ctx : Context ): Boolean =
228
- ( if (isCurrent(fs)) myFlags else flags). isAllOf(fs)
233
+ final inline def isAllOf (fs : FlagSet )(implicit ctx : Context ): Boolean =
234
+ isAllOf(fs, EmptyFlags )
229
235
230
236
/** Has this denotation all of the flags in `fs` set, whereas none of the flags
231
237
* in `butNot` are set?
232
238
*/
233
239
final def isAllOf (fs : FlagSet , butNot : FlagSet )(implicit ctx : Context ): Boolean =
234
- isAllOf(fs) && ! isOneOf(butNot)
240
+ val immutable = immutableFlags
241
+ val (fsImmut, fsMut) = fs.partitionByIntersection(immutable)
242
+ val (butNotImmut, butNotMut) = butNot.partitionByIntersection(immutable)
243
+
244
+ fsImmut <= myFlags &&
245
+ (butNotImmut & myFlags).isEmpty &&
246
+ (fsMut.isEmpty || fsMut <= flags) &&
247
+ (butNotMut.isEmpty || (butNotMut & flags).isEmpty)
248
+
235
249
236
250
/** The type info, or, if symbol is not yet completed, the completer */
237
251
final def infoOrCompleter : Type = myInfo
0 commit comments