diff options
author | phaller <hallerp@gmail.com> | 2012-08-12 17:17:54 +0200 |
---|---|---|
committer | phaller <hallerp@gmail.com> | 2012-08-12 17:17:54 +0200 |
commit | 834a8faa123f168e8baea772b06ebce2874ff431 (patch) | |
tree | e8a61c40476530b10ab676827d8fbaade812ba75 /test/files/continuations-run/t5314.scala | |
parent | 47519b4eb6b4aec78e3c13e08811c7346c61acc4 (diff) | |
download | scala-834a8faa123f168e8baea772b06ebce2874ff431.tar.gz scala-834a8faa123f168e8baea772b06ebce2874ff431.tar.bz2 scala-834a8faa123f168e8baea772b06ebce2874ff431.zip |
Simplify the adaptation of types of return expressions
Add `adaptTypeOfReturn` hook to `AnnotationCheckers`.
Move adaptation of types of return expressions from `addAnnotations`
to `typedReturn` via `adaptTypeOfReturn` hook.
This resolves an inconsistency where previously types could have
a plus marker without additional CPS annotations. This also adds
additional test cases.
Diffstat (limited to 'test/files/continuations-run/t5314.scala')
-rw-r--r-- | test/files/continuations-run/t5314.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/continuations-run/t5314.scala b/test/files/continuations-run/t5314.scala index 0bdea19824..d611016ce4 100644 --- a/test/files/continuations-run/t5314.scala +++ b/test/files/continuations-run/t5314.scala @@ -29,6 +29,17 @@ 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 |