summaryrefslogtreecommitdiff
path: root/test/files/run/t1247.scala
diff options
context:
space:
mode:
authorJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-08 21:16:33 +0200
committerJohannes Rudolph <johannes_rudolph@gmx.de>2012-05-08 21:46:56 +0200
commit00a648bc909f794d91570fb962fc7d7fcd055bc5 (patch)
tree19e0b891ab425e7f569a03a9158d3b610b70cd38 /test/files/run/t1247.scala
parentda04d691c455aa3f3391bdbd9bac7fb59f29cedf (diff)
downloadscala-00a648bc909f794d91570fb962fc7d7fcd055bc5.tar.gz
scala-00a648bc909f794d91570fb962fc7d7fcd055bc5.tar.bz2
scala-00a648bc909f794d91570fb962fc7d7fcd055bc5.zip
fix SI-1247: don't create a thunk for a by-name argument if the argument expression is a Function0 application
Diffstat (limited to 'test/files/run/t1247.scala')
-rw-r--r--test/files/run/t1247.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/run/t1247.scala b/test/files/run/t1247.scala
new file mode 100644
index 0000000000..c709b73bc8
--- /dev/null
+++ b/test/files/run/t1247.scala
@@ -0,0 +1,11 @@
+object Test extends App {
+ val f = () => 5
+ def test(g: => Int) {
+ val gFunc = g _
+ val isSameClosureClass = gFunc.getClass == f.getClass
+ val isSame = gFunc eq f
+ println("Is same closure class: "+isSameClosureClass+" is same closure: "+isSame)
+ }
+
+ test(f())
+}