diff options
author | Martin Odersky <odersky@gmail.com> | 2003-05-21 15:53:09 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2003-05-21 15:53:09 +0000 |
commit | 2cc25288dd36b43c66ee4448856851ede5e8d6b2 (patch) | |
tree | 2511e78517123c3db740fe7dba7886ac1be0d488 /sources/scalac/symtab/Symbol.java | |
parent | 22d0a607cd8cc270f66657c2ad3b71d1ecb77698 (diff) | |
download | scala-2cc25288dd36b43c66ee4448856851ede5e8d6b2.tar.gz scala-2cc25288dd36b43c66ee4448856851ede5e8d6b2.tar.bz2 scala-2cc25288dd36b43c66ee4448856851ede5e8d6b2.zip |
*** empty log message ***
Diffstat (limited to 'sources/scalac/symtab/Symbol.java')
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 1b3ee71659..4c2080fd40 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -630,7 +630,7 @@ public abstract class Symbol implements Modifiers, Kinds { /** The low bound of this type variable */ public Type loBound() { - throw new ApplicationError("loBound inapplicable for " + this); + return Global.instance.definitions.ALL_TYPE; } /** Get this.type corresponding to this symbol @@ -719,7 +719,12 @@ public abstract class Symbol implements Modifiers, Kinds { * of `c' as indirect base class? */ public boolean isSubClass(Symbol c) { - return this == c || c.kind == Kinds.ERROR || closurePos(c) >= 0; + return this == c || + c.kind == Kinds.ERROR || + closurePos(c) >= 0 || + this == Global.instance.definitions.ALL_CLASS || + (this == Global.instance.definitions.ALLREF_CLASS && + c.isSubClass(Global.instance.definitions.ANYREF_CLASS)); } /** Get base types of this symbol */ @@ -1004,8 +1009,8 @@ public class TypeSymbol extends Symbol { /** Return a fresh symbol with the same fields as this one. */ public Symbol cloneSymbol() { - if (Global.instance.debug) System.out.println("cloning " + this + this.locationString() + " in phase " + Global.instance.currentPhase.name()); TypeSymbol other = new TypeSymbol(kind, pos, name, owner(), flags); + if (Global.instance.debug) System.out.println("cloning " + this + this.locationString() + " to " + other + " in phase " + Global.instance.currentPhase.name()); other.setInfo(info()); return other; } @@ -1137,8 +1142,8 @@ public class AbsTypeSymbol extends TypeSymbol { /** Return a fresh symbol with the same fields as this one. */ public Symbol cloneSymbol() { - if (Global.instance.debug) System.out.println("cloning " + this + this.locationString() + " in phase " + Global.instance.currentPhase.name()); TypeSymbol other = new AbsTypeSymbol(pos, name, owner(), flags); + if (Global.instance.debug) System.out.println("cloning " + this + this.locationString() + " to " + other + " in phase " + Global.instance.currentPhase.name()); other.setInfo(info()); other.setLoBound(loBound()); return other; @@ -1287,8 +1292,12 @@ public class ClassSymbol extends TypeSymbol { /** Get type */ public Type type() { if (template == null || template.typeArgs().length != typeParams().length) { - template = Type.TypeRef( - owner().thisType(), this, type(typeParams())); + Symbol[] tparams = typeParams(); + if (tparams.length == 0) + template = typeConstructor(); + else + template = Type.TypeRef( + owner().thisType(), this, type(typeParams())); } return template; } |