|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, abstract type members were allowed in objects only when inherited,
but not when declared directly. This inconsistency was not intended. In dotty,
abstract type members are allowed in values and represent existentials; so upon
discussion, it was decided to fix things to conform to dotty and allow such type
members. Adriaan also asked to keep rejecting abstract type members in methods
even though they would conceivably make sense.
Discussions happened on #3407, scala/scala-dist#127.
This code is improved from #3442, keeps closer to the current logic, and passes tests.
Existing tests that have been converted to `pos` tests show that
this works, and a new test has been added to show that local
aliases (ie term-owned) without a RHS are still rejected.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|