diff options
Diffstat (limited to 'sources/scalac/symtab')
-rw-r--r-- | sources/scalac/symtab/Scope.java | 2 | ||||
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 8 | ||||
-rw-r--r-- | sources/scalac/symtab/SymbolCloner.java | 5 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/Pickle.java | 7 | ||||
-rw-r--r-- | sources/scalac/symtab/classfile/UnPickle.java | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/sources/scalac/symtab/Scope.java b/sources/scalac/symtab/Scope.java index c9daf10c5a..d0a2bf5b9b 100644 --- a/sources/scalac/symtab/Scope.java +++ b/sources/scalac/symtab/Scope.java @@ -189,7 +189,7 @@ public class Scope { /** enter a symbol */ public Scope enter(Symbol sym) { - assert !sym.isConstructor(); + // assert !sym.isConstructor(); return enter(new Entry(sym, this)); } diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 00161b7745..a98e44844d 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -60,8 +60,6 @@ public abstract class Symbol implements Modifiers, Kinds { /** Generic symbol constructor */ public Symbol(int kind, int pos, Name name, Symbol owner, int flags) { - assert (!isTerm() || !name.isTypeName()) && (!isType() || name.isTypeName()); - this.kind = kind; this.pos = pos; this.name = name; @@ -1023,6 +1021,7 @@ public class TermSymbol extends Symbol { /** Constructor */ public TermSymbol(int pos, Name name, Symbol owner, int flags) { super(VAL, pos, name, owner, flags); + assert !name.isTypeName() : this; } public static TermSymbol define( @@ -1039,7 +1038,7 @@ public class TermSymbol extends Symbol { public static TermSymbol newConstructor(Symbol clazz, int flags) { TermSymbol sym = new TermSymbol( - clazz.pos, clazz.name, clazz.owner(), flags | FINAL); + clazz.pos, Names.CONSTRUCTOR, clazz.owner(), flags | FINAL); sym.clazz = clazz; return sym; } @@ -1098,7 +1097,7 @@ public class TermSymbol extends Symbol { /** Is this symbol a constructor? */ public boolean isConstructor() { - return name.isTypeName(); + return name == Names.CONSTRUCTOR; } /** Return a fresh symbol with the same fields as this one. @@ -1155,6 +1154,7 @@ public abstract class TypeSymbol extends Symbol { /** Constructor */ public TypeSymbol(int kind, int pos, Name name, Symbol owner, int flags) { super(kind, pos, name, owner, flags); + assert name.isTypeName() : this; if (kind != TYPE) this.constructor = TermSymbol.newConstructor(this, flags & ~MODUL); } diff --git a/sources/scalac/symtab/SymbolCloner.java b/sources/scalac/symtab/SymbolCloner.java index c75958be40..8863cf24ff 100644 --- a/sources/scalac/symtab/SymbolCloner.java +++ b/sources/scalac/symtab/SymbolCloner.java @@ -85,7 +85,10 @@ public class SymbolCloner { assert !clones.containsKey(symbol) : Debug.show(symbol) + " -> " + Debug.show(clones.get(symbol)); Symbol clone = symbol.cloneSymbol(getOwnerFor(symbol)); - if (rename) clone.name = renamer.newName(symbol.name); + if (rename) { + assert !symbol.isConstructor(): symbol; + clone.name = renamer.newName(symbol.name); + } clones.put(symbol, clone); return clone; } diff --git a/sources/scalac/symtab/classfile/Pickle.java b/sources/scalac/symtab/classfile/Pickle.java index 58b2888d79..8cf0efd2de 100644 --- a/sources/scalac/symtab/classfile/Pickle.java +++ b/sources/scalac/symtab/classfile/Pickle.java @@ -80,8 +80,10 @@ public class Pickle implements Kinds, Modifiers, EntryTags { */ private boolean isLocal(Symbol sym) { return - sym.name.toTermName() == rootname && - sym.owner() == rootowner || + sym.name.toTermName() == rootname && sym.owner() == rootowner + || + sym.isConstructor() && isLocal(sym.primaryConstructorClass()) + || (sym.kind != NONE && isLocal(sym.owner())); } @@ -333,6 +335,7 @@ public class Pickle implements Kinds, Modifiers, EntryTags { } else { writeByte(EXTref); writeByte(0); // space for length + assert !sym.isConstructor() : sym; writeRef(sym.name); } if (sym.owner() != Global.instance.definitions.ROOT_CLASS) diff --git a/sources/scalac/symtab/classfile/UnPickle.java b/sources/scalac/symtab/classfile/UnPickle.java index 4e2eb566fb..2e333e5cd2 100644 --- a/sources/scalac/symtab/classfile/UnPickle.java +++ b/sources/scalac/symtab/classfile/UnPickle.java @@ -264,7 +264,7 @@ public class UnPickle implements Kinds, Modifiers, EntryTags { case VALsym: if (bp < end) { Symbol tsym = readSymbolRef(); - if (name.isTypeName()) { + if (name == Names.CONSTRUCTOR) { entries[n] = sym = tsym.primaryConstructor(); sym.flags = flags; } else { |