aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/Flags.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-02-11 00:11:25 +1100
committerMartin Odersky <odersky@gmail.com>2017-04-04 13:29:38 +0200
commitc245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0 (patch)
tree8a116622aacd162b206a9dfcacab5db74e3427e8 /compiler/src/dotty/tools/dotc/core/Flags.scala
parent8f3c9a80cd464a962abeede37087ed52a6d9970a (diff)
downloaddotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.tar.gz
dotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.tar.bz2
dotty-c245600ed4bfd4af6f2b45e8cae2cf5a63ddeaf0.zip
More fine-grained distinctions when flags are defined.
Flags like Trait are in fact not always defined when a symbol is created. For symbols loaded from class files, this flag, and some other is defined only once the classfile has been loaded. But this happens in general before the symbol is completed. We model this distinction by separating from the `FromStartFlags` set a new set `AfterLoadFlags` and distinguishing between the two sets in `SymDenotations#is`. Test case is enum-Option.scala. This erroneously complained before that `Enum` was not a trait.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/Flags.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Flags.scala17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/Flags.scala b/compiler/src/dotty/tools/dotc/core/Flags.scala
index c1267d8a2..29f1078a2 100644
--- a/compiler/src/dotty/tools/dotc/core/Flags.scala
+++ b/compiler/src/dotty/tools/dotc/core/Flags.scala
@@ -450,13 +450,22 @@ object Flags {
/** Flags guaranteed to be set upon symbol creation */
final val FromStartFlags =
- AccessFlags | Module | Package | Deferred | Final | MethodOrHKCommon | Param | ParamAccessor | Scala2ExistentialCommon |
- Mutable.toCommonFlags | InSuperCall | Touched | JavaStatic | CovariantOrOuter | ContravariantOrLabel | ExpandedName | AccessorOrSealed |
- CaseAccessorOrBaseTypeArg | Fresh | Frozen | Erroneous | ImplicitCommon | Permanent | Synthetic |
- Inline | LazyOrTrait | SuperAccessorOrScala2x | SelfNameOrImplClass
+ Module | Package | Deferred | MethodOrHKCommon | Param | ParamAccessor |
+ Scala2ExistentialCommon | Mutable.toCommonFlags | InSuperCall | Touched | JavaStatic |
+ CovariantOrOuter | ContravariantOrLabel | ExpandedName | CaseAccessorOrBaseTypeArg |
+ Fresh | Frozen | Erroneous | ImplicitCommon | Permanent | Synthetic |
+ SuperAccessorOrScala2x | Inline
+
+ /** Flags guaranteed to be set upon symbol creation, or, if symbol is a top-level
+ * class or object, when the class file defining the symbol is loaded (which
+ * is generally before the symbol is completed
+ */
+ final val AfterLoadFlags =
+ FromStartFlags | AccessFlags | Final | AccessorOrSealed | LazyOrTrait | SelfNameOrImplClass
assert(FromStartFlags.isTermFlags && FromStartFlags.isTypeFlags)
// TODO: Should check that FromStartFlags do not change in completion
+ assert(AfterLoadFlags.isTermFlags && AfterLoadFlags.isTypeFlags)
/** A value that's unstable unless complemented with a Stable flag */
final val UnstableValue = Mutable | Method