diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-06-16 14:47:26 -0400 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-06-16 17:11:07 -0400 |
commit | 9f2b2894ba2b45135943e943d13898aefc333cc2 (patch) | |
tree | 4221d0b7e9f756cae01a4cf8f3703be105ca94fa /test/files | |
parent | 83ae74ce9d3ff56c47b39e44332daa3da2981133 (diff) | |
download | scala-9f2b2894ba2b45135943e943d13898aefc333cc2.tar.gz scala-9f2b2894ba2b45135943e943d13898aefc333cc2.tar.bz2 scala-9f2b2894ba2b45135943e943d13898aefc333cc2.zip |
SI-7584 Test and spurious warning fix for by-name closures
The enclosed test case exercises by-name closures, which were
the subject of the previous commit. In the process, a spurious
warning was eliminated.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/t7584.check | 6 | ||||
-rw-r--r-- | test/files/run/t7584.flags | 1 | ||||
-rw-r--r-- | test/files/run/t7584.scala | 14 |
3 files changed, 21 insertions, 0 deletions
diff --git a/test/files/run/t7584.check b/test/files/run/t7584.check new file mode 100644 index 0000000000..9f53e5dde5 --- /dev/null +++ b/test/files/run/t7584.check @@ -0,0 +1,6 @@ +no calls +call A +a +call B twice +b +b diff --git a/test/files/run/t7584.flags b/test/files/run/t7584.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/run/t7584.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/run/t7584.scala b/test/files/run/t7584.scala new file mode 100644 index 0000000000..6d7f4f7ebb --- /dev/null +++ b/test/files/run/t7584.scala @@ -0,0 +1,14 @@ +// Test case added to show the behaviour of functions with +// by-name parameters. The evaluation behaviour was already correct. +// +// We did flush out a spurious "pure expression does nothing in statement position" +// warning, hence -Xfatal-warnings in the flags file. +object Test extends App { + def foo(f: (=> Int, => Int) => Unit) = f({println("a"); 0}, {println("b"); 1}) + println("no calls") + foo((a, b) => ()) + println("call A") + foo((a, b) => a) + println("call B twice") + foo((a, b) => {b; b}) +} |