diff options
Diffstat (limited to 'src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala')
-rw-r--r-- | src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala index 1783264e5c..99838dfc25 100644 --- a/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala +++ b/src/continuations/plugin/scala/tools/selectivecps/SelectiveANFTransform.scala @@ -43,6 +43,12 @@ 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)) @@ -440,7 +446,9 @@ abstract class SelectiveANFTransform extends PluginComponent with Transform with // all is well if (hasPlusMarker(expr.tpe)) { - unit.warning(tree.pos, "expression " + expr + " of type " + expr.tpe + " is not expected to have a cps type") + // 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") expr modifyType removeAllCPSAnnotations } |