summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2004-01-26 15:48:23 +0000
committerpaltherr <paltherr@epfl.ch>2004-01-26 15:48:23 +0000
commit4a61569db4162006387848eedc4dc241f9d07c8e (patch)
treebb4dee338ea8ffa973c559f32dbfe528636731e4 /sources
parentee9aea08d4065bfb0c5761140e1a1d80d37748f7 (diff)
downloadscala-4a61569db4162006387848eedc4dc241f9d07c8e.tar.gz
scala-4a61569db4162006387848eedc4dc241f9d07c8e.tar.bz2
scala-4a61569db4162006387848eedc4dc241f9d07c8e.zip
- Removed method Type.rebind
- Simplified some type transformers
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/symtab/Type.java59
-rw-r--r--sources/scalac/transformer/ExpandMixinsPhase.java5
2 files changed, 17 insertions, 47 deletions
diff --git a/sources/scalac/symtab/Type.java b/sources/scalac/symtab/Type.java
index c0d7e3c043..413b67303a 100644
--- a/sources/scalac/symtab/Type.java
+++ b/sources/scalac/symtab/Type.java
@@ -1298,14 +1298,6 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
return NoType;
}
- /** Return overriding instance of `sym' in this type,
- * or `sym' itself if none exists.
- */
- // !!! remove !
- public Symbol rebind(Symbol sym) {
- return sym;
- }
-
/** A map to implement `asSeenFrom'.
*/
static class AsSeenFromMap extends Map {
@@ -1318,39 +1310,27 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
this.clazz = clazz;
}
- public Type apply(Type t) {
- //System.out.println(t + " as seen from " + pre + "," + clazz);//DEBUG
- if (pre == NoType || clazz.kind != CLASS) return t;
- switch (t) {
+ public Type apply(Type type) {
+ //System.out.println(type + " as seen from " + pre + "," + clazz);//DEBUG
+ if (pre == NoType || clazz.kind != CLASS) return type;
+ switch (type) {
case ThisType(Symbol sym):
- return t.toPrefix(sym, pre, clazz);
+ return type.toPrefix(sym, pre, clazz);
case TypeRef(Type prefix, Symbol sym, Type[] args):
- if (sym.kind == ALIAS && sym.typeParams().length == args.length) {
- return apply(sym.info().subst(sym.typeParams(), args)
- .asSeenFrom(prefix, sym.owner()));
- } else if (sym.owner().isPrimaryConstructor()) {
+ if (sym.owner().isPrimaryConstructor()) {
assert sym.kind == TYPE;
- return t.toInstance(sym, pre, clazz);
- } else {
- Type prefix1 = apply(prefix);
- Type[] args1 = map(args);
- if (prefix1 == prefix && args1 == args) return t;
- Symbol sym1 = prefix1.rebind(sym);
- Type t1 = typeRef(prefix1, sym1, args1);
- if (sym1 != sym) t1 = apply(t1.unalias());
- return t1;
+ return type.toInstance(sym, pre, clazz);
}
+ return map(type);
case SingleType(Type prefix, Symbol sym):
try {
- Type prefix1 = apply(prefix);
- if (prefix1 == prefix) return t;
- else return singleType(prefix1, prefix1.rebind(sym));
+ return map(type);
} catch (Type.Malformed ex) {}
- return apply(t.singleDeref());
+ return apply(type.singleDeref());
default:
- return map(t);
+ return map(type);
}
}
}
@@ -1757,18 +1737,12 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
public SubstThisMap(Symbol oldSym, Symbol newSym) {
this(oldSym, newSym.thisType());
}
- public Type apply(Type t) {
- switch (t) {
+ public Type apply(Type type) {
+ switch (type) {
case ThisType(Symbol sym):
- if (sym == from) return to;
- else return t;
- case TypeRef(Type pre, Symbol sym, Type[] args):
- Type pre1 = apply(pre);
- Type[] args1 = map(args);
- if (pre1 == pre && args1 == args) return t;
- else return typeRef(pre1, pre1.rebind(sym), args1);
+ return sym == from ? to : type;
default:
- return map(t);
+ return map(type);
}
}
}
@@ -2007,8 +1981,7 @@ public class Type implements Modifiers, Kinds, TypeTags, EntryTags {
case TypeRef(Type pre1, Symbol sym1, Type[] args1):
switch (this) {
case TypeRef(Type pre, Symbol sym, Type[] args):
- if (pre.isSubType(pre1) &&
- (sym == sym1 || sym == pre.rebind(sym1)) &&
+ if (sym == sym1 && pre.isSubType(pre1) &&
isSubArgs(args, args1, sym.typeParams())
||
sym.kind == TYPE && pre.memberInfo(sym).isSubType(that))
diff --git a/sources/scalac/transformer/ExpandMixinsPhase.java b/sources/scalac/transformer/ExpandMixinsPhase.java
index 83ec681a38..e45568d17d 100644
--- a/sources/scalac/transformer/ExpandMixinsPhase.java
+++ b/sources/scalac/transformer/ExpandMixinsPhase.java
@@ -419,10 +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;
- if (!symbol.isClassType()) { // !!! why do we need that ?
- prefix = apply(prefix);
- symbol = prefix.rebind(symbol);
- }
+ prefix = apply(prefix);
args = map(args);
return Type.typeRef(prefix, symbol, args).unalias();
case SingleType(Type prefix, Symbol symbol):