diff options
author | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-09 07:49:32 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@typesafe.com> | 2015-07-09 07:49:32 +0200 |
commit | 057664807902aeab50e399455d7c7917e9a6d071 (patch) | |
tree | 0c46e5a6a8a6cb091d8142162ae8744af73ddb27 /test/files | |
parent | 41edbe65a738a4a109f1b76b977354a3fee474c0 (diff) | |
parent | 04977b71e6e7097afdd1cbe0d2c7514591ed3f9e (diff) | |
download | scala-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')
-rw-r--r-- | test/files/run/indylambda-specialization.scala | 15 |
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) + } +} |