Skip to content

Commit 44ed627

Browse files
butNot-capable predicates on flags complete only when absolutely necessary
1 parent 4506028 commit 44ed627

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,13 @@ object SymDenotations {
215215
* in `butNot` are set?
216216
*/
217217
final def is(flag: Flag, butNot: FlagSet)(implicit ctx: Context): Boolean =
218-
(if (isCurrent(flag) && isCurrent(butNot)) myFlags else flags).is(flag, butNot)
218+
is(flag) && !isOneOf(butNot)
219219

220220
/** Has this denotation one of the flags in `fs` set, whereas none of the flags
221221
* in `butNot` are set?
222222
*/
223223
final def isOneOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean =
224-
(if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags).isOneOf(fs, butNot)
224+
isOneOf(fs) && !isOneOf(butNot)
225225

226226
/** Has this denotation all of the flags in `fs` set? */
227227
final def isAllOf(fs: FlagSet)(implicit ctx: Context): Boolean =
@@ -231,7 +231,7 @@ object SymDenotations {
231231
* in `butNot` are set?
232232
*/
233233
final def isAllOf(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context): Boolean =
234-
(if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags).isAllOf(fs, butNot)
234+
isAllOf(fs) && !isOneOf(butNot)
235235

236236
/** The type info, or, if symbol is not yet completed, the completer */
237237
final def infoOrCompleter: Type = myInfo

0 commit comments

Comments
 (0)