summaryrefslogtreecommitdiff
path: root/sources/scalac/transformer/LambdaLift.java
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2003-08-13 10:53:30 +0000
committerMartin Odersky <odersky@gmail.com>2003-08-13 10:53:30 +0000
commitb56a6d699c9003e8412955fe16159351578cf92b (patch)
treeab307d835a9502c40570939537cc5cc6901d5ca3 /sources/scalac/transformer/LambdaLift.java
parent1bbbb4c44fc0ea2fd36d18b579474efb7641fd09 (diff)
downloadscala-b56a6d699c9003e8412955fe16159351578cf92b.tar.gz
scala-b56a6d699c9003e8412955fe16159351578cf92b.tar.bz2
scala-b56a6d699c9003e8412955fe16159351578cf92b.zip
*** empty log message ***
Diffstat (limited to 'sources/scalac/transformer/LambdaLift.java')
-rw-r--r--sources/scalac/transformer/LambdaLift.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java
index 099b26a46d..9651f928dd 100644
--- a/sources/scalac/transformer/LambdaLift.java
+++ b/sources/scalac/transformer/LambdaLift.java
@@ -488,18 +488,24 @@ public class LambdaLift extends OwnerTransformer
((ClassDef) tree).mods |= LIFTED;
Symbol sym = tree.symbol();
assert sym.isLocal() : sym;
- liftSymbol(sym, ftvsParams(sym.primaryConstructor()), fvsParams(sym.primaryConstructor()));
+ Symbol constr = sym.primaryConstructor();
+ liftSymbol(
+ sym, get(free.ftvs, constr).toArray(),
+ ftvsParams(constr), fvsParams(constr));
break;
case DefDef(_, _, _, _, _, _):
((DefDef) tree).mods |= LIFTED;
Symbol sym = tree.symbol();
assert sym.isLocal() : sym;
- liftSymbol(sym, ftvsParams(sym), fvsParams(sym));
+ liftSymbol(
+ sym, get(free.ftvs, sym).toArray(),
+ ftvsParams(sym), fvsParams(sym));
}
}
- void liftSymbol(Symbol sym, Symbol[] newtparams, Symbol[] newparams) {
+ void liftSymbol(Symbol sym, Symbol[] oldtparams,
+ Symbol[] newtparams, Symbol[] newparams) {
Symbol enclClass = sym.owner().enclClass();
if (!sym.isPrimaryConstructor()) sym.setOwner(enclClass);
if (!sym.isConstructor()) enclClass.members().enter(sym);
@@ -507,28 +513,29 @@ public class LambdaLift extends OwnerTransformer
if (newtparams.length != 0 || newparams.length != 0) {
sym.updateInfo(
addParams(
- addTypeParams(sym.infoAt(descr.nextPhase), newtparams),
+ addTypeParams(
+ sym.infoAt(descr.nextPhase), oldtparams, newtparams),
newparams));
if (global.debug)
global.log(sym + " has now type " + sym.typeAt(descr.nextPhase));
}
} else if (sym.kind == CLASS) {
- liftSymbol(sym.primaryConstructor(), newtparams, newparams);
+ liftSymbol(sym.primaryConstructor(), oldtparams, newtparams, newparams);
} else {
throw new ApplicationError();
}
}
- Type addTypeParams(Type tp, Symbol[] newtparams) {
+ Type addTypeParams(Type tp, Symbol[] oldtparams, Symbol[] newtparams) {
if (newtparams.length == 0) return tp;
switch (tp) {
case MethodType(_, _):
- return Type.PolyType(newtparams, tp);
+ return Type.PolyType(newtparams, tp.subst(oldtparams, newtparams));
case PolyType(Symbol[] tparams, Type restpe):
Symbol[] tparams1 = new Symbol[tparams.length + newtparams.length];
System.arraycopy(tparams, 0, tparams1, 0, tparams.length);
System.arraycopy(newtparams, 0, tparams1, tparams.length, newtparams.length);
- return Type.PolyType(tparams1, restpe);
+ return Type.PolyType(tparams1, restpe.subst(oldtparams, newtparams));
default:
throw new ApplicationError("illegal type: " + tp);
}