summaryrefslogtreecommitdiff
path: root/sources/scalac/transformer
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/transformer')
-rw-r--r--sources/scalac/transformer/AddInterfacesPhase.java11
-rw-r--r--sources/scalac/transformer/ExplicitOuterClassesPhase.java19
2 files changed, 14 insertions, 16 deletions
diff --git a/sources/scalac/transformer/AddInterfacesPhase.java b/sources/scalac/transformer/AddInterfacesPhase.java
index 6cf968bfef..388510059d 100644
--- a/sources/scalac/transformer/AddInterfacesPhase.java
+++ b/sources/scalac/transformer/AddInterfacesPhase.java
@@ -97,17 +97,6 @@ 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.compoundTypeWithOwner(sym.owner(), parents, members);
- default:
- throw Debug.abort("illegal case", tp +" -- "+ Debug.show(sym));
- }
} else
return tp;
}
diff --git a/sources/scalac/transformer/ExplicitOuterClassesPhase.java b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
index c79ff1ae29..9cb4837033 100644
--- a/sources/scalac/transformer/ExplicitOuterClassesPhase.java
+++ b/sources/scalac/transformer/ExplicitOuterClassesPhase.java
@@ -81,7 +81,7 @@ public class ExplicitOuterClassesPhase extends Phase {
if (show && !symbol.isPackageClass()) System.out.println("!!! <<< transformInfo - type : " + Debug.show(type));
if (symbol.isPackageClass()) return type; // !!!
TypeContext context = getTypeContextFor(symbol);
- if (symbol.isConstructor() && symbol.constructorClass().isClassType()) { // !!! isClassType -> isClass ?
+ if (symbol.isConstructor() && symbol.constructorClass().isClassType() && !symbol.constructorClass().isCompoundSym()) { // !!! isClassType -> isClass ?
Symbol clasz = symbol.constructorClass();
Symbol[] tparams = type.typeParams();
Symbol[] vparams = type.valueParams();
@@ -144,8 +144,16 @@ public class ExplicitOuterClassesPhase extends Phase {
/** Returns the type context for the given symbol. */
private TypeContext getTypeContextFor(Symbol symbol) {
- while (!symbol.isClassType() && !(symbol.isConstructor() && symbol.constructorClass().isClassType())) // !!! isClassType -> isClass ?
+ while (true) {
+ Symbol test = symbol;
+ if (test.isConstructor()) test = test.constructorClass();
+ // !!! isClassType -> isClass ?
+ if (test.isClassType() && !test.isCompoundSym()) break;
symbol = symbol.owner();
+ }
+// !!!
+// while (!symbol.isClassType() && !(symbol.isConstructor() && symbol.constructorClass().isClassType())) // !!! isClassType -> isClass ?
+// symbol = symbol.owner();
if (symbol.isClassType())
symbol = symbol.primaryConstructor();
TypeContext context = (TypeContext)contexts.get(symbol);
@@ -349,7 +357,7 @@ public class ExplicitOuterClassesPhase extends Phase {
Object value = tparams.get(symbol);
return value != null ? (Type)value : type;
}
- if (symbol.isClass()) {
+ if (symbol.isClass() && !symbol.isCompoundSym()) {
args = map(getNewArgsOf(context, prefix, symbol, args));
prefix = Type.NoPrefix;
return Type.typeRef(prefix, symbol, args);
@@ -363,11 +371,12 @@ public class ExplicitOuterClassesPhase extends Phase {
case SingleType(Type prefix, Symbol symbol):
return Type.singleType(apply(prefix), symbol);
case ThisType(Symbol clasz):
- if (clasz == context.clasz) return type;
+ // !!! || clasz.isCompoundSym()
+ if (clasz == context.clasz || clasz.isCompoundSym()) return type;
for (int i = 0; i < context.outers.length; i++)
if (clasz == context.outers[i].clasz)
return context.getTypeLink(i);
- throw Debug.abort("illegal ThisType", type);
+ throw Debug.abort("illegal ThisType", clasz);
case CompoundType(Type[] parents, Scope members):
// !!! this case should not be needed
return Type.compoundType(map(parents), members, type.symbol());