@@ -818,7 +818,8 @@ abstract class UnCurry extends InfoTransform
818
818
*
819
819
* This transformation erases the dependent method types by:
820
820
* - Widening the formal parameter type to existentially abstract
821
- * over the prior parameters (using `packSymbols`)
821
+ * over the prior parameters (using `packSymbols`). This transformation
822
+ * is performed in the the `InfoTransform`er [[scala.reflect.internal.transform.UnCurry ]].
822
823
* - Inserting casts in the method body to cast to the original,
823
824
* precise type.
824
825
*
@@ -846,15 +847,14 @@ abstract class UnCurry extends InfoTransform
846
847
*/
847
848
def erase (dd : DefDef ): (List [List [ValDef ]], Tree ) = {
848
849
import dd .{ vparamss , rhs }
849
- val vparamSyms = vparamss flatMap (_ map (_.symbol))
850
-
851
850
val paramTransforms : List [ParamTransform ] =
852
- vparamss.flatten.map { p =>
853
- val declaredType = p.symbol.info
854
- // existentially abstract over value parameters
855
- val packedType = typer.packSymbols(vparamSyms, declaredType)
856
- if (packedType =:= declaredType) Identity (p)
851
+ map2(vparamss.flatten, dd.symbol.info.paramss.flatten) { (p, infoParam) =>
852
+ val packedType = infoParam.info
853
+ if (packedType =:= p.symbol.info) Identity (p)
857
854
else {
855
+ // The Uncurry info transformer existentially abstracted over value parameters
856
+ // from the previous parameter lists.
857
+
858
858
// Change the type of the param symbol
859
859
p.symbol updateInfo packedType
860
860
@@ -866,8 +866,8 @@ abstract class UnCurry extends InfoTransform
866
866
// the method body to refer to this, rather than the parameter.
867
867
val tempVal : ValDef = {
868
868
val tempValName = unit freshTermName (p.name + " $" )
869
- val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC ).setInfo(declaredType )
870
- atPos(p.pos)(ValDef (newSym, gen.mkAttributedCast(Ident (p.symbol), declaredType )))
869
+ val newSym = dd.symbol.newTermSymbol(tempValName, p.pos, SYNTHETIC ).setInfo(p.symbol.info )
870
+ atPos(p.pos)(ValDef (newSym, gen.mkAttributedCast(Ident (p.symbol), p.symbol.info )))
871
871
}
872
872
Packed (newParam, tempVal)
873
873
}
@@ -885,13 +885,6 @@ abstract class UnCurry extends InfoTransform
885
885
Block (tempVals, rhsSubstituted)
886
886
}
887
887
888
- // update the type of the method after uncurry.
889
- dd.symbol updateInfo {
890
- val GenPolyType (tparams, tp) = dd.symbol.info
891
- logResult(" erased dependent param types for ${dd.symbol.info}" ) {
892
- GenPolyType (tparams, MethodType (allParams map (_.symbol), tp.finalResultType))
893
- }
894
- }
895
888
(allParams :: Nil , rhs1)
896
889
}
897
890
}
0 commit comments