From 00a648bc909f794d91570fb962fc7d7fcd055bc5 Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Tue, 8 May 2012 21:16:33 +0200 Subject: fix SI-1247: don't create a thunk for a by-name argument if the argument expression is a Function0 application --- test/files/run/t1247.check | 1 + test/files/run/t1247.scala | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/files/run/t1247.check create mode 100644 test/files/run/t1247.scala (limited to 'test') diff --git a/test/files/run/t1247.check b/test/files/run/t1247.check new file mode 100644 index 0000000000..ce123032fd --- /dev/null +++ b/test/files/run/t1247.check @@ -0,0 +1 @@ +Is same closure class: true is same closure: true 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()) +} -- cgit v1.2.3