summaryrefslogtreecommitdiff
path: root/test/files/run
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@typesafe.com>2015-07-09 07:49:32 +0200
committerLukas Rytz <lukas.rytz@typesafe.com>2015-07-09 07:49:32 +0200
commit057664807902aeab50e399455d7c7917e9a6d071 (patch)
tree0c46e5a6a8a6cb091d8142162ae8744af73ddb27 /test/files/run
parent41edbe65a738a4a109f1b76b977354a3fee474c0 (diff)
parent04977b71e6e7097afdd1cbe0d2c7514591ed3f9e (diff)
downloadscala-057664807902aeab50e399455d7c7917e9a6d071.tar.gz
scala-057664807902aeab50e399455d7c7917e9a6d071.tar.bz2
scala-057664807902aeab50e399455d7c7917e9a6d071.zip
Merge pull request #4609 from retronym/topic/indylambda-test
[indylambda] Improve test coverage
Diffstat (limited to 'test/files/run')
-rw-r--r--test/files/run/indylambda-specialization.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/files/run/indylambda-specialization.scala b/test/files/run/indylambda-specialization.scala
new file mode 100644
index 0000000000..2c66073e90
--- /dev/null
+++ b/test/files/run/indylambda-specialization.scala
@@ -0,0 +1,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)
+ }
+}