From 75e36233a0ea290cee98a35bc295feed4b18237e Mon Sep 17 00:00:00 2001 From: phaller Date: Mon, 23 Jul 2012 14:03:22 +0200 Subject: SI-5314 - CPS transform of return statement fails Enable return expressions in CPS code if they are in tail position. Note that tail returns are only removed in methods that do not call `shift` or `reset` (otherwise, an error is reported). Addresses the issues pointed out in a previous pull request: https://github.com/scala/scala/pull/720 - Addresses all issues mentioned here: https://github.com/scala/scala/pull/720#issuecomment-6429705 - Move transformation methods to SelectiveANFTransform.scala: https://github.com/scala/scala/pull/720#commitcomment-1477497 - Do not keep a list of tail returns. Tests: - continuations-neg/t5314-missing-result-type.scala - continuations-neg/t5314-type-error.scala - continuations-neg/t5314-npe.scala - continuations-neg/t5314-return-reset.scala - continuations-run/t5314.scala - continuations-run/t5314-2.scala - continuations-run/t5314-3.scala --- test/files/continuations-neg/t5314-missing-result-type.check | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/files/continuations-neg/t5314-missing-result-type.check (limited to 'test/files/continuations-neg/t5314-missing-result-type.check') diff --git a/test/files/continuations-neg/t5314-missing-result-type.check b/test/files/continuations-neg/t5314-missing-result-type.check new file mode 100644 index 0000000000..341e580cf3 --- /dev/null +++ b/test/files/continuations-neg/t5314-missing-result-type.check @@ -0,0 +1,4 @@ +t5314-missing-result-type.scala:6: error: method bar has return statement; needs result type + def bar(x:Int) = return foo(x) + ^ +one error found -- cgit v1.2.3