summaryrefslogtreecommitdiff
path: root/test/files/run/t3855.scala
blob: 32dfb1e23d025c46a5fd55200a60c77e76e7544b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)
  }
}