summaryrefslogblamecommitdiff
path: root/test/files/run/t7584.scala
blob: 6d7f4f7ebbab45d16916c325ca12b2474e0174a3 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                                   
// Test case added to show the behaviour of functions with
// by-name parameters.  The evaluation behaviour was already correct.
//
// We did flush out a spurious "pure expression does nothing in statement position"
// warning, hence -Xfatal-warnings in the flags file.
object Test extends App {
  def foo(f: (=> Int, => Int) => Unit) = f({println("a"); 0}, {println("b"); 1})
  println("no calls")
  foo((a, b) => ())
  println("call A")
  foo((a, b) => a)
  println("call B twice")
  foo((a, b) => {b; b})
}