Skip to content

Commit dbcb45c

Browse files
committed
ordering tweaks
1 parent 8d2f9b7 commit dbcb45c

File tree

1 file changed

+31
-33
lines changed

1 file changed

+31
-33
lines changed

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

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ object Flags {
416416

417417
// --------- Combined Flag Sets and Conjunctions ----------------------
418418

419+
/** All possible flags */
420+
val AnyFlags: FlagSet = flagRange(FirstFlag, MaxFlag)
421+
422+
/** These flags are pickled */
423+
val PickledFlags: FlagSet = flagRange(FirstFlag, FirstNotPickledFlag)
424+
425+
/** Flags representing access rights */
426+
val AccessFlags: FlagSet = Local | Private | Protected
427+
419428
/** Flags representing source modifiers */
420429
private val CommonSourceModifierFlags: FlagSet =
421430
commonFlags(Private, Protected, Final, Case, Implicit, Implied, Given, Override, JavaStatic)
@@ -432,11 +441,6 @@ object Flags {
432441
TermSourceModifierFlags.toCommonFlags |
433442
commonFlags(Module, Param, Synthetic, Package, Local, Mutable, Trait)
434443

435-
assert(ModifierFlags.isTermFlags && ModifierFlags.isTypeFlags)
436-
437-
/** Flags representing access rights */
438-
val AccessFlags: FlagSet = Private | Protected | Local
439-
440444
/** Flags that are not (re)set when completing the denotation
441445
* TODO: Should check that FromStartFlags do not change in completion
442446
*/
@@ -448,7 +452,6 @@ object Flags {
448452
Extension, NonMember, Implicit, Given, Implied, Permanent, Synthetic,
449453
SuperAccessorOrScala2x, Inline)
450454

451-
452455
/** Flags that are not (re)set when completing the denotation, or, if symbol is
453456
* a top-level class or object, when completing the denotation once the class
454457
* file defining the symbol is loaded (which is generally before the denotation
@@ -464,9 +467,7 @@ object Flags {
464467
/** Flags that express the variance of a type parameter. */
465468
val VarianceFlags: FlagSet = Covariant | Contravariant
466469

467-
/** Flags that are passed from a type parameter of a class to a refinement symbol
468-
* that sets the type parameter */
469-
val RetainedTypeArgFlags: FlagSet = VarianceFlags | Protected | Local
470+
// ----- Creation flag sets ----------------------------------
470471

471472
/** Modules always have these flags set */
472473
val ModuleValCreationFlags: FlagSet = ModuleVal | Lazy | Final | StableRealizable
@@ -480,15 +481,23 @@ object Flags {
480481
/** Pure interfaces always have these flags */
481482
val PureInterfaceCreationFlags: FlagSet = Trait | NoInits | PureInterface
482483

483-
val NoInitsInterface: FlagSet = NoInits | PureInterface
484-
485484
/** The flags of the self symbol */
486485
val SelfSymFlags: FlagSet = Private | Local | Deferred
487486

488487
/** The flags of a class type parameter */
489488
val ClassTypeParamCreationFlags: FlagSet =
490489
TypeParam | Deferred | Private | Local
491490

491+
/** Packages and package classes always have these flags set */
492+
val PackageCreationFlags: FlagSet =
493+
Module | Package | Final | JavaDefined
494+
495+
// ----- Retained flag sets ----------------------------------
496+
497+
/** Flags that are passed from a type parameter of a class to a refinement symbol
498+
* that sets the type parameter */
499+
val RetainedTypeArgFlags: FlagSet = VarianceFlags | Protected | Local
500+
492501
/** Flags that can apply to both a module val and a module class, except those that
493502
* are added at creation anyway
494503
*/
@@ -505,50 +514,39 @@ object Flags {
505514
/** Flags that can apply to a module class */
506515
val RetainedModuleClassFlags: FlagSet = RetainedModuleValAndClassFlags | Enum
507516

508-
/** Packages and package classes always have these flags set */
509-
val PackageCreationFlags: FlagSet =
510-
Module | Package | Final | JavaDefined
517+
/** Flags retained in export forwarders */
518+
val RetainedExportFlags = ImplicitOrImpliedOrGiven | Extension
511519

512-
/** All possible flags */
513-
val AnyFlags: FlagSet = flagRange(FirstFlag, MaxFlag)
520+
// ------- Other flag sets -------------------------------------
514521

515-
/** These flags are pickled */
516-
val PickledFlags: FlagSet = flagRange(FirstFlag, FirstNotPickledFlag)
522+
val NoInitsInterface: FlagSet = NoInits | PureInterface
517523

518-
/** An abstract class or a trait */
519524
val AbstractOrTrait: FlagSet = Abstract | Trait
520525

521-
/** Labeled `private` or `protected[local]` */
522-
val PrivateOrLocal: FlagSet = Private | Local
526+
val PrivateOrLocal: FlagSet = Local | Private // Labelled `private` or `protected[local]`
523527

524-
/** Either a module or a final class */
525-
val ModuleOrFinal: FlagSet = ModuleClass | Final
528+
val ModuleOrFinal: FlagSet = Final | ModuleClass // A module class or a final class
526529

527-
/** Either mutable or lazy */
528-
val MutableOrLazy: FlagSet = Mutable | Lazy
530+
val MutableOrLazy: FlagSet = Lazy | Mutable
529531

530-
/** Either method or lazy */
531-
val MethodOrLazy: FlagSet = Method | Lazy
532+
val MethodOrLazy: FlagSet = Lazy | Method
532533

533-
/** Either method or module */
534534
val MethodOrModule: FlagSet = Method | Module
535535

536536
/** Either method or lazy or deferred */
537-
val MethodOrLazyOrDeferred: FlagSet = Method | Lazy | Deferred
537+
val MethodOrLazyOrDeferred: FlagSet = Deferred | Lazy | Method
538538

539539
/** An inline method or inline argument proxy */
540540
val InlineOrProxy: FlagSet = Inline | InlineProxy
541541

542542
val ImplicitOrImplied: FlagSet = Implicit | Implied
543-
val ImplicitOrImpliedOrGiven: FlagSet = Implicit | Implied | Given
544-
val ImplicitOrGiven: FlagSet = Implicit | Given
543+
val ImplicitOrImpliedOrGiven: FlagSet = Given | Implicit | Implied
544+
val ImplicitOrGiven: FlagSet = Given | Implicit
545545

546546
val ImpliedOrGiven: FlagSet = Implied | Given
547547

548548
val ImplicitOrImpliedOrGivenTerm = ImplicitOrImpliedOrGiven.toTermFlags
549549

550-
/** Flags retained in export forwarders */
551-
val RetainedExportFlags = ImplicitOrImpliedOrGiven | Extension
552550

553551
/** Assumed to be pure */
554552
val StableOrErased: FlagSet = StableRealizable | Erased

0 commit comments

Comments
 (0)