Browse files

Revert "Add missing cases in tail return transform"

This reverts commit 8d020fa.
  • Loading branch information...
1 parent e566ab3 commit 007eedf97de9d430f2f959abe3feafe3c37bad19 @phaller phaller committed Aug 9, 2012
View
9 src/continuations/plugin/scala/tools/selectivecps/CPSUtils.scala
@@ -169,8 +169,13 @@ trait CPSUtils {
// anf transform
- def getExternalAnswerTypeAnn(tp: Type) =
- cpsParamTypes(tp) orElse None
+ def getExternalAnswerTypeAnn(tp: Type) = {
+ cpsParamTypes(tp) orElse {
+ if (hasPlusMarker(tp))
+ global.warning("trying to instantiate type " + tp + " to unknown cps type")
+ None
+ }
+ }
def getAnswerTypeAnn(tp: Type): Option[(Type, Type)] =
cpsParamTypes(tp) filterNot (_ => hasPlusMarker(tp))
View
10 src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala
@@ -43,12 +43,6 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
case If(cond, r1 @ Return(thenExpr), r2 @ Return(elseExpr)) =>
treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
- case If(cond, r1 @ Return(thenExpr), elseExpr) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
- case If(cond, thenExpr, r2 @ Return(elseExpr)) =>
- treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
-
case If(cond, thenExpr, elseExpr) =>
treeCopy.If(tree, cond, transform(thenExpr), transform(elseExpr))
@@ -446,9 +440,7 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with
// all is well
if (hasPlusMarker(expr.tpe)) {
- // the following warning no longer applies, since expr may have originated from a tail return expr
- // note that it would be illegal to remove the plus marker (thus disabling required transformations)
- //unit.warning(tree.pos, "expression " + expr + " of type " + expr.tpe + " is not expected to have a cps type")
+ unit.warning(tree.pos, "expression " + expr + " of type " + expr.tpe + " is not expected to have a cps type")
expr modifyType removeAllCPSAnnotations
}
View
4 test/files/continuations-run/t5314.check
@@ -1,7 +1,3 @@
-7
-7
-7
-8
8
hi
8
View
11 test/files/continuations-run/t5314.scala
@@ -29,17 +29,6 @@ object Test extends App {
def nocps(x: Int): Int = { return x; x }
- def foo2(x:Int): Int @cps[Int] = 7
- def bar2(x:Int): Int @cps[Int] = { foo2(x); return 7 }
- def bar3(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else return foo2(x) }
- def bar4(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else foo2(x) }
- def bar5(x:Int): Int @cps[Int] = { foo2(x); if (x == 7) return 7 else 8 }
- println(reset { bar2(10) })
- println(reset { bar3(10) })
- println(reset { bar4(10) })
- println(reset { bar5(10) })
-
- /* original test case */
val repro = new ReturnRepro
repro.caller
repro.caller2

0 comments on commit 007eedf

Please sign in to comment.