summaryrefslogtreecommitdiff
path: root/test/disabled/run/indylambda-specialization.scala
blob: 2c66073e906dbf1a42dfcdc01bce0ac18b2b0609 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
object Test {
  def assertApply(expected: Boolean) = {
    val frames = Thread.currentThread.getStackTrace.takeWhile(_.getMethodName != "main")
    val usesObjectApply = frames.exists(_.getMethodName == "apply")
    assert(expected == usesObjectApply, frames.mkString("\n"))
  }
  def assertSpecialized() = assertApply(false)
  def assertUnspecialized() = assertApply(true)
  def main(args: Array[String]): Unit = {
    ((i: String)      => {assertUnspecialized(); i}).apply("")
    (()               => {assertSpecialized(); 0}).apply()
    ((i: Int)         => {assertSpecialized(); i}).apply(0)
    ((i: Int, j: Int) => {assertSpecialized(); i + j}).apply(0, 0)
  }
}