diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-04-10 10:29:11 +0300 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-04-10 10:29:11 +0300 |
commit | 6e7b32649b041a001fdb61ca184c57e4c8228056 (patch) | |
tree | ab3c1142e2a3fcbe9ed5ef674ecac9147b5dcd70 /src/compiler | |
parent | 3cf7c958fdb83258e7ad626f5a6c7fa8a4b2241b (diff) | |
parent | 1e7a990e028dffc5fa8ac07a02ff3f79bde24749 (diff) | |
download | scala-6e7b32649b041a001fdb61ca184c57e4c8228056.tar.gz scala-6e7b32649b041a001fdb61ca184c57e4c8228056.tar.bz2 scala-6e7b32649b041a001fdb61ca184c57e4c8228056.zip |
Merge pull request #4373 from retronym/topic/indylambda-permutations-2
SI-8359 Adjust parameter order of accessor method in Delambdafy
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/LambdaLift.scala | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala index 5e2fe21eec..d1be1558b9 100644 --- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala +++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala @@ -376,7 +376,7 @@ abstract class LambdaLift extends InfoTransform { private def addFreeArgs(pos: Position, sym: Symbol, args: List[Tree]) = { free get sym match { - case Some(fvs) => args ++ (fvs.toList map (fv => atPos(pos)(proxyRef(fv)))) + case Some(fvs) => addFree(sym, free = fvs.toList map (fv => atPos(pos)(proxyRef(fv))), original = args) case _ => args } } @@ -388,9 +388,9 @@ abstract class LambdaLift extends InfoTransform { case DefDef(_, _, _, vparams :: _, _, _) => val addParams = cloneSymbols(ps).map(_.setFlag(PARAM)) sym.updateInfo( - lifted(MethodType(sym.info.params ::: addParams, sym.info.resultType))) + lifted(MethodType(addFree(sym, free = addParams, original = sym.info.params), sym.info.resultType))) - copyDefDef(tree)(vparamss = List(vparams ++ freeParams)) + copyDefDef(tree)(vparamss = List(addFree(sym, free = freeParams, original = vparams))) case ClassDef(_, _, _, _) => // SI-6231 // Disabled attempt to to add getters to freeParams @@ -571,4 +571,12 @@ abstract class LambdaLift extends InfoTransform { } } // class LambdaLifter + private def addFree[A](sym: Symbol, free: List[A], original: List[A]): List[A] = { + val prependFree = ( + !sym.isConstructor // this condition is redundant for now. It will be needed if we remove the second condition in 2.12.x + && (settings.Ydelambdafy.value == "method" && sym.isDelambdafyTarget) // SI-8359 Makes the lambda body a viable as the target MethodHandle for a call to LambdaMetafactory + ) + if (prependFree) free ::: original + else original ::: free + } } |