summaryrefslogblamecommitdiff
path: root/test/files/run/t3855.scala
blob: e55714201fbc7da05f4d0718fd0ff8022c45069f (plain) (tree)
1
2
3
4


                                  
  













                                                 
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)
  }
}