summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-07-24 14:55:10 +0200
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-07-24 15:28:15 +0200
commit75eb8a49842075bcaa2878b262443b48aafec2ab (patch)
tree94b68b5f76e9b4247235f55c20a05964eb23bac5
parent82dea8af9612ed26ebb01375f369d0c6033662ba (diff)
downloadscala-75eb8a49842075bcaa2878b262443b48aafec2ab.tar.gz
scala-75eb8a49842075bcaa2878b262443b48aafec2ab.tar.bz2
scala-75eb8a49842075bcaa2878b262443b48aafec2ab.zip
use hasAllFlags to detect gadt skolems
trying to compromise between - easy discovery of what special mix of flags identifies a gadt skolem - ensuring that hasAllFlags is used and not hasFlag keeping the secret combo close to the creator/detector methods instead of moving them to Flags ideally, we'd allocate a new bit in Flags, but that's to invasive right now these symbols are also relatively short-lived: thet are created in adaptConstrPattern and removed at the end of typedCase
-rw-r--r--src/reflect/scala/reflect/internal/Symbols.scala12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/Symbols.scala b/src/reflect/scala/reflect/internal/Symbols.scala
index 10d02376b1..b82d483893 100644
--- a/src/reflect/scala/reflect/internal/Symbols.scala
+++ b/src/reflect/scala/reflect/internal/Symbols.scala
@@ -585,10 +585,16 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
skolem setInfo (basis.info cloneInfo skolem)
}
+ // don't test directly -- use isGADTSkolem
+ // used to single out a gadt skolem symbol in deskolemizeGADT
+ // gadtskolems are created in adaptConstrPattern and removed at the end of typedCase
+ @inline final protected[Symbols] def GADT_SKOLEM_FLAGS = CASEACCESSOR | SYNTHETIC
+
// flags set up to maintain TypeSkolem's invariant: origin.isInstanceOf[Symbol] == !hasFlag(EXISTENTIAL)
- // CASEACCESSOR | SYNTHETIC used to single this symbol out in deskolemizeGADT
+ // GADT_SKOLEM_FLAGS (== CASEACCESSOR | SYNTHETIC) used to single this symbol out in deskolemizeGADT
+ // TODO: it would be better to allocate a new bit in the flag long for GADTSkolem rather than OR'ing together CASEACCESSOR | SYNTHETIC
def newGADTSkolem(name: TypeName, origin: Symbol, info: Type): TypeSkolem =
- newTypeSkolemSymbol(name, origin, origin.pos, origin.flags & ~(EXISTENTIAL | PARAM) | CASEACCESSOR | SYNTHETIC) setInfo info
+ newTypeSkolemSymbol(name, origin, origin.pos, origin.flags & ~(EXISTENTIAL | PARAM) | GADT_SKOLEM_FLAGS) setInfo info
final def freshExistential(suffix: String): TypeSymbol =
newExistential(freshExistentialName(suffix), pos)
@@ -2958,7 +2964,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>
// a type symbol bound by an existential type, for instance the T in
// List[T] forSome { type T }
override def isExistentialSkolem = this hasFlag EXISTENTIAL
- override def isGADTSkolem = this hasFlag CASEACCESSOR | SYNTHETIC
+ override def isGADTSkolem = this hasAllFlags GADT_SKOLEM_FLAGS
override def isTypeSkolem = this hasFlag PARAM
override def isAbstractType = this hasFlag DEFERRED