summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2008-02-20 15:48:44 +0000
committerMartin Odersky <odersky@gmail.com>2008-02-20 15:48:44 +0000
commit2e68a9c580b22cc54a80121de1946c6986a16a6b (patch)
tree9484fc459b70b562143b13d2c58aeddc127d20a1
parente715cdd0c40299f87450260077891410601ff5b7 (diff)
downloadscala-2e68a9c580b22cc54a80121de1946c6986a16a6b.tar.gz
scala-2e68a9c580b22cc54a80121de1946c6986a16a6b.tar.bz2
scala-2e68a9c580b22cc54a80121de1946c6986a16a6b.zip
fixed problem with too optimistic beta reduction.
-rw-r--r--src/compiler/scala/tools/nsc/transform/UnCurry.scala8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/UnCurry.scala b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
index 5ffb6fed71..af822968ba 100644
--- a/src/compiler/scala/tools/nsc/transform/UnCurry.scala
+++ b/src/compiler/scala/tools/nsc/transform/UnCurry.scala
@@ -446,19 +446,23 @@ abstract class UnCurry extends InfoTransform with TypingTransformers {
case ValDef(_, _, _, rhs)
if (!tree.symbol.owner.isSourceMethod) =>
withNeedLift(true) { super.transform(tree) }
-
+/*
case Apply(Select(Block(List(), Function(vparams, body)), nme.apply), args) =>
// perform beta-reduction; this helps keep view applications small
+ println("beta-reduce1: "+tree)
withNeedLift(true) {
mainTransform(new TreeSubstituter(vparams map (_.symbol), args).transform(body))
}
case Apply(Select(Function(vparams, body), nme.apply), args) =>
+// if (List.forall2(vparams, args)((vparam, arg) => treeInfo.isAffineIn(body) ||
+// treeInfo.isPureExpr(arg))) =>
// perform beta-reduction; this helps keep view applications small
+ println("beta-reduce2: "+tree)
withNeedLift(true) {
mainTransform(new TreeSubstituter(vparams map (_.symbol), args).transform(body))
}
-
+*/
case UnApply(fn, args) =>
inPattern = false
val fn1 = transform(fn)