summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-11-27 14:05:19 +0000
committerpaltherr <paltherr@epfl.ch>2003-11-27 14:05:19 +0000
commit7871d529b643a55bc2bfbc327f7f4faa99feb76a (patch)
tree0130bcdba6d34c46b24508f970895d35c758f477
parentcbbb75f1bdbb7b46207b3e600bf2b57cae94d36f (diff)
downloadscala-7871d529b643a55bc2bfbc327f7f4faa99feb76a.tar.gz
scala-7871d529b643a55bc2bfbc327f7f4faa99feb76a.tar.bz2
scala-7871d529b643a55bc2bfbc327f7f4faa99feb76a.zip
- Added special transformation of typeOfThis
- Removed erasure of typeOfThis
-rw-r--r--sources/scalac/transformer/AddInterfacesPhase.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/sources/scalac/transformer/AddInterfacesPhase.java b/sources/scalac/transformer/AddInterfacesPhase.java
index 2536a4bc1d..c878742737 100644
--- a/sources/scalac/transformer/AddInterfacesPhase.java
+++ b/sources/scalac/transformer/AddInterfacesPhase.java
@@ -103,6 +103,17 @@ public class AddInterfacesPhase extends Phase {
}
return Type.compoundType(newParents, newMembers, sym);
+ } else if (sym.isThisSym() && hasInterfaceSymbol(sym.owner())) {
+ switch (tp) {
+ case TypeRef(_, _, _):
+ return sym.owner().nextType();
+ case CompoundType(Type[] parents, Scope members):
+ parents = Type.cloneArray(parents);
+ parents[parents.length - 1] = sym.owner().nextType();
+ return Type.compoundType(parents, members, tp.symbol());
+ default:
+ throw Debug.abort("illegal case", tp +" -- "+ Debug.show(sym));
+ }
} else
return tp;
}
@@ -220,10 +231,6 @@ public class AddInterfacesPhase extends Phase {
classMemberMap.put(iConstr, cConstr);
}
- // Remove type of this
- if (classSym.thisSym() != classSym)
- classSym.setTypeOfThis(Type.NoType);
-
// Clone all members, entering them in the class scope.
Scope classMembers = new Scope();
Scope.SymbolIterator ifaceMembersIt =