diff options
Diffstat (limited to 'test/files/run/t3855.scala')
-rw-r--r-- | test/files/run/t3855.scala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/files/run/t3855.scala b/test/files/run/t3855.scala new file mode 100644 index 0000000000..32dfb1e23d --- /dev/null +++ b/test/files/run/t3855.scala @@ -0,0 +1,18 @@ +object Test { + def byval[A](a: => A) = a + def closure[A](f: () => A) = f() + + def f1(s: String) = { + var n = try { s.toInt } catch { case _ => 1 } + byval(n) + } + def f2(s: String) = { + var n = try { s.toInt } catch { case _ => 1 } + closure(() => n) + } + + def main(args: Array[String]) = { + val sum = f1("12") + f2("the witch is dead") + assert(sum == 13) + } +} |