diff options
author | Paul Phillips <paulp@improving.org> | 2010-11-11 05:18:59 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-11-11 05:18:59 +0000 |
commit | 82770a97b82f07a1cbbf133c123e4e5aa982d336 (patch) | |
tree | 2315104080f4ea96e977e2a7450005712dc7fb1f /test/files | |
parent | bd86b89077131370e422eccd4939ddef6c32c98c (diff) | |
download | scala-82770a97b82f07a1cbbf133c123e4e5aa982d336.tar.gz scala-82770a97b82f07a1cbbf133c123e4e5aa982d336.tar.bz2 scala-82770a97b82f07a1cbbf133c123e4e5aa982d336.zip |
Introduces "Origins" for all your superhero bac...
Introduces "Origins" for all your superhero backstory needs. It logs
where all the calls are coming from: that's all for the moment. It's
explained in the comments and test case, so I'm sure you don't need it
all repeated here. No review.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/run/origins.check | 6 | ||||
-rw-r--r-- | test/files/run/origins.scala | 21 |
2 files changed, 27 insertions, 0 deletions
diff --git a/test/files/run/origins.check b/test/files/run/origins.check new file mode 100644 index 0000000000..c088ea05c2 --- /dev/null +++ b/test/files/run/origins.check @@ -0,0 +1,6 @@ + +>> Origins goxbox.Socks.boop logged 65 calls from 3 distinguished sources. + + 50 Test$$anonfun$f3$1.apply$mcII$sp(origins.scala:16) + 10 Test$$anonfun$f2$1.apply$mcII$sp(origins.scala:15) + 5 Test$$anonfun$f1$1.apply$mcII$sp(origins.scala:14) diff --git a/test/files/run/origins.scala b/test/files/run/origins.scala new file mode 100644 index 0000000000..4c98e7a66c --- /dev/null +++ b/test/files/run/origins.scala @@ -0,0 +1,21 @@ +import scala.tools.nsc.util.Origins + +package goxbox { + object Socks { + val origins = Origins[Socks.type]("boop") + + def boop(x: Int): Int = origins { 5 } + } +} + +object Test { + import goxbox.Socks.boop + + def f1() = 1 to 5 map boop + def f2() = 1 to 10 map boop + def f3() = 1 to 50 map boop + + def main(args: Array[String]): Unit = { + f1() ; f2() ; f3() + } +} |