summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/scalac/transformer/LambdaLift.java28
1 files changed, 2 insertions, 26 deletions
diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java
index bf934877ae..67b396ec2e 100644
--- a/sources/scalac/transformer/LambdaLift.java
+++ b/sources/scalac/transformer/LambdaLift.java
@@ -558,43 +558,19 @@ public class LambdaLift extends OwnerTransformer
case MethodType(_, _):
return Type.PolyType(
newtparams,
- new UpdateSubstSymMap(oldtparams, newtparams).apply(tp));
+ Type.getUpdateSubst(oldtparams, newtparams).apply(tp));
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,
- new UpdateSubstSymMap(oldtparams, newtparams).apply(restpe));
+ Type.getUpdateSubst(oldtparams, newtparams).apply(restpe));
default:
throw new ApplicationError("illegal type: " + tp);
}
}
- /* A substitution map which, instead of cloning parameters, updates
- * their symbol's types.
- */
- static class UpdateSubstSymMap extends Type.SubstSymMap {
- protected UpdateSubstSymMap(Symbol[] from, Symbol[] to) {
- super(from, to);
- }
- public Type apply(Type t) {
- switch (t) {
- case MethodType(Symbol[] params, Type result):
- for (int i = 0; i < params.length; i++) {
- Type tp = params[i].type();
- Type tp1 = apply(tp);
- if (tp != tp1) params[i].updateInfo(tp1);
- }
- Type result1 = apply(result);
- if (result1 == result) return t;
- else return Type.MethodType(params, result1);
- default:
- return super.apply(t);
- }
- }
- }
-
Type addParams(Type tp, Symbol[] newparams) {
if (newparams.length == 0) return tp;
switch (tp) {