aboutsummaryrefslogtreecommitdiff
path: root/compiler/src
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/src')
-rw-r--r--compiler/src/dotty/tools/dotc/core/Flags.scala17
-rw-r--r--compiler/src/dotty/tools/dotc/core/SymDenotations.scala13
-rw-r--r--compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala2
3 files changed, 23 insertions, 9 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
diff --git a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
index db96463e0..27782698d 100644
--- a/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
+++ b/compiler/src/dotty/tools/dotc/core/SymDenotations.scala
@@ -163,26 +163,31 @@ object SymDenotations {
setFlag(flags & mask)
}
+ private def isCurrent(fs: FlagSet) =
+ fs <= (
+ if (myInfo.isInstanceOf[SymbolLoader]) FromStartFlags
+ else AfterLoadFlags)
+
/** Has this denotation one of the flags in `fs` set? */
final def is(fs: FlagSet)(implicit ctx: Context) = {
- (if (fs <= FromStartFlags) myFlags else flags) is fs
+ (if (isCurrent(fs)) myFlags else flags) is fs
}
/** Has this denotation one of the flags in `fs` set, whereas none of the flags
* in `butNot` are set?
*/
final def is(fs: FlagSet, butNot: FlagSet)(implicit ctx: Context) =
- (if (fs <= FromStartFlags && butNot <= FromStartFlags) myFlags else flags) is (fs, butNot)
+ (if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags) is (fs, butNot)
/** Has this denotation all of the flags in `fs` set? */
final def is(fs: FlagConjunction)(implicit ctx: Context) =
- (if (fs <= FromStartFlags) myFlags else flags) is fs
+ (if (isCurrent(fs)) myFlags else flags) is fs
/** Has this denotation all of the flags in `fs` set, whereas none of the flags
* in `butNot` are set?
*/
final def is(fs: FlagConjunction, butNot: FlagSet)(implicit ctx: Context) =
- (if (fs <= FromStartFlags && butNot <= FromStartFlags) myFlags else flags) is (fs, butNot)
+ (if (isCurrent(fs) && isCurrent(butNot)) myFlags else flags) is (fs, butNot)
/** The type info.
* The info is an instance of TypeType iff this is a type denotation
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
index 57365658e..b0f5f8ab1 100644
--- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
+++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala
@@ -238,7 +238,7 @@ object messages {
import core.Flags._
val maxDist = 3
val decls = site.decls.flatMap { sym =>
- if (sym.is(Synthetic | PrivateOrLocal) || sym.isConstructor) Nil
+ if (sym.flagsUNSAFE.is(Synthetic | PrivateOrLocal) || sym.isConstructor) Nil
else List((sym.name.show, sym))
}