diff options
author | paltherr <paltherr@epfl.ch> | 2004-01-26 16:27:14 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2004-01-26 16:27:14 +0000 |
commit | 24549f229ead9fce5b2cc920ca98ac3004389fa4 (patch) | |
tree | 365f97f539825bae98587ebd8dedcdac57f2b411 /sources | |
parent | 9c37599cf6f7c775bd877313cf4bc68b1227caa5 (diff) | |
download | scala-24549f229ead9fce5b2cc920ca98ac3004389fa4.tar.gz scala-24549f229ead9fce5b2cc920ca98ac3004389fa4.tar.bz2 scala-24549f229ead9fce5b2cc920ca98ac3004389fa4.zip |
- Simplified some type transformers (removed un...
- Simplified some type transformers (removed unaliasing)
Diffstat (limited to 'sources')
-rw-r--r-- | sources/scalac/symtab/Symbol.java | 3 | ||||
-rw-r--r-- | sources/scalac/symtab/Type.java | 34 | ||||
-rw-r--r-- | sources/scalac/transformer/ExpandMixinsPhase.java | 4 |
3 files changed, 5 insertions, 36 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index 8264f448c1..b37cb278bc 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -1639,7 +1639,6 @@ public abstract class TypeSymbol extends Symbol { } //where private static Map inclClosure(Map closure, Type type) { - type = type.unalias(); switch (type) { case ErrorType: return closure; @@ -1791,7 +1790,7 @@ public class ClassSymbol extends TypeSymbol { Symbol clasz = ClassSymbol.this; Symbol alias = rebindSym; Type prefix = clasz.owner().thisType(); - Type constrtype = clasz.type(); // !!! + Type constrtype = clasz.type(); constrtype = Type.MethodType(Symbol.EMPTY_ARRAY, constrtype); constrtype = Type.PolyType(clasz.typeParams(), constrtype); constrtype = constrtype.cloneType( diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java index 413b67303a..7abd0133ff 100644 --- a/sources/scalac/symtab/Type.java +++ b/sources/scalac/symtab/Type.java @@ -548,11 +548,6 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { if (n == 100) throw new Type.Error("alias chain too long (recursive type alias?): " + this); switch (this) { - case TypeRef(Type pre, Symbol sym, Type[] args): - if (sym.kind == ALIAS && sym.typeParams().length == args.length) - return sym.info().subst(sym.typeParams(), args) - .asSeenFrom(pre, sym.owner()).unalias(n + 1); - break; case TypeVar(Type origin, Constraint constr): if (constr.inst != NoType) return constr.inst.unalias(n + 1); else return this; @@ -1271,10 +1266,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { return sym.info() .asSeenFrom(pre, sym.owner()).baseType(clazz); else if (sym.kind == ALIAS) - if (sym.typeParams().length == args.length) - return sym.info().subst(sym.typeParams(), args) - .asSeenFrom(pre, sym.owner()).baseType(clazz); - else return Type.NoType; + return Type.NoType; else if (clazz.isCompoundSym()) return NoType; else { @@ -2087,9 +2079,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { if (sym1.kind == TYPE && this.isSubType(that.loBound())) return true; } - if (sym.kind == ALIAS && sym.typeParams().length == args.length) - return this.unalias().isSubType(that); - else if (sym == Global.instance.definitions.ALL_CLASS) + if (sym == Global.instance.definitions.ALL_CLASS) return that.isSubType(Global.instance.definitions.ANY_TYPE()); else if (sym == Global.instance.definitions.ALLREF_CLASS) return @@ -2118,13 +2108,6 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { // !!! we should probably also test for Clonable, Serializable, ... } - switch (that) { - case TypeRef(_, Symbol sym1, Type[] args): - if (sym1.kind == ALIAS && sym1.typeParams().length == args.length) - return this.isSubType(that.unalias()); - break; - } - return false; } @@ -2357,21 +2340,11 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { switch (this) { case NoType: return false; - case TypeRef(_, Symbol sym, Type[] args): - if (sym.kind == ALIAS && sym.typeParams().length == args.length) - return this.unalias().isSameAs(that); - break; case TypeVar(Type origin, Constraint constr): if (constr.inst != NoType) return constr.inst.isSameAs(that); else return constr.instantiate(that.any2typevar()); } - switch (that) { - case TypeRef(_, Symbol sym, Type[] args): - if (sym.kind == ALIAS && sym.typeParams().length == args.length) - return this.isSameAs(that.unalias()); - } - return false; } //where @@ -3207,8 +3180,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags { private Type upperBound() { switch (this) { case TypeRef(Type pre, Symbol sym, Type[] args): - if (sym.kind == ALIAS && sym.typeParams().length == args.length - || sym.kind == TYPE) + if (sym.kind == TYPE) return pre.memberInfo(sym).upperBound(); } return this; diff --git a/sources/scalac/transformer/ExpandMixinsPhase.java b/sources/scalac/transformer/ExpandMixinsPhase.java index e45568d17d..76fa37aea6 100644 --- a/sources/scalac/transformer/ExpandMixinsPhase.java +++ b/sources/scalac/transformer/ExpandMixinsPhase.java @@ -419,9 +419,7 @@ public class ExpandMixinsPhase extends Phase { case TypeRef(Type prefix, Symbol symbol, Type[] args): Type inline = (Type)inlines.get(symbol); if (inline != null) return inline; - prefix = apply(prefix); - args = map(args); - return Type.typeRef(prefix, symbol, args).unalias(); + return map(type); case SingleType(Type prefix, Symbol symbol): // !!! prefix = apply(prefix); // !!! symbol = prefix.rebind(symbol); |