summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Namers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-01-14 11:02:46 -0800
committerPaul Phillips <paulp@improving.org>2012-01-14 12:10:00 -0800
commit2ca7d4ff90fedcd2dba654100bd8d6ce1f1ad36b (patch)
tree8e2d5ae0d6b435bc56389a88ca098afd4cbf1c6b /src/compiler/scala/tools/nsc/typechecker/Namers.scala
parent964fc6ee55dec031b5d697114db84a365425baf8 (diff)
downloadscala-2ca7d4ff90fedcd2dba654100bd8d6ce1f1ad36b.tar.gz
scala-2ca7d4ff90fedcd2dba654100bd8d6ce1f1ad36b.tar.bz2
scala-2ca7d4ff90fedcd2dba654100bd8d6ce1f1ad36b.zip
Symbols making friends with Polly Morphism.
Since I have established (no small effort, this) that there is no need for certain important flags to be mutable for the entire lifetime of a symbol, I have codified this knowledge by moving it out of the flags entirely and into the inheritance hierarchy where its constant nature can find true happiness. AliasTypeSymbol ... it's an alias (forever!) AbstractTypeSymbol ... it's an abstract type (forever!) The only time DEFERRED is inspected is if the generic creation function is called (e.g. "newTypeSymbol", not "newAliasType") in which case the presence of the flag is used to determine which symbol to create. This is mostly for legacy support. Certain symbols were being created inconsistently with the others. Now every symbol is created by invoking a creation method on the owner, with the exception of FreeVar. I changed the owner of those from RootClass to NoSymbol because there is no reason for them to pollute the symbol hierarchy at the root. The signature of cloneSymbolImpl is now def cloneSymbolImpl(owner: Symbol, newFlags: Long): Symbol There is an overload with the old signature which calls that one with no flags. With this step, every symbol creation in trunk is performed with knowledge of the initial flags, opening the door to many optimizations in the Symbol and Type logic, not to mention boosting my sanity by at least five sanity points.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Namers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index 71c0de10ff..354b8caaa3 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -1390,10 +1390,9 @@ trait Namers extends MethodSynthesis {
)
if (sym hasAnnotation NativeAttr)
sym resetFlag DEFERRED
- else if (!symbolAllowsDeferred && ownerRequiresConcrete) {
+ else if (!symbolAllowsDeferred && ownerRequiresConcrete)
fail("only classes can have declared but undefined members" + abstractVarMessage(sym))
- sym resetFlag DEFERRED
- }
+
checkWithDeferred(PRIVATE)
checkWithDeferred(FINAL)
}