summaryrefslogtreecommitdiff
path: root/test/pending/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/pending/run')
-rw-r--r--test/pending/run/idempotency-partial-functions.scala2
-rw-r--r--test/pending/run/reflection-sync-potpourri.scala32
-rw-r--r--test/pending/run/t5943b1.scala2
3 files changed, 34 insertions, 2 deletions
diff --git a/test/pending/run/idempotency-partial-functions.scala b/test/pending/run/idempotency-partial-functions.scala
index bc0ca706dd..e673da5a29 100644
--- a/test/pending/run/idempotency-partial-functions.scala
+++ b/test/pending/run/idempotency-partial-functions.scala
@@ -20,7 +20,7 @@ object Test extends App {
case e: ToolBoxError => println(e)
}
val tb = cm.mkToolBox()
- val tpartials = tb.typeCheck(partials.tree)
+ val tpartials = tb.typecheck(partials.tree)
println(tpartials)
val rtpartials = tb.resetAllAttrs(tpartials)
println(tb.eval(rtpartials))
diff --git a/test/pending/run/reflection-sync-potpourri.scala b/test/pending/run/reflection-sync-potpourri.scala
new file mode 100644
index 0000000000..0ad5f2ab66
--- /dev/null
+++ b/test/pending/run/reflection-sync-potpourri.scala
@@ -0,0 +1,32 @@
+import scala.reflect.runtime.universe._
+
+// this test checks that under heavily multithreaded conditions:
+// 1) scala.reflect.runtime.universe, its rootMirror and definitions are initialized correctly
+// 2) symbols are correctly materialized into PackageScopes (no dupes)
+// 3) unpickling works okay even we unpickle the same symbol a lot of times
+
+object Test extends App {
+ def foo[T: TypeTag](x: T) = typeOf[T].toString
+ val n = 1000
+ val rng = new scala.util.Random()
+ val types = List(
+ () => typeOf[java.lang.reflect.Method],
+ () => typeOf[java.lang.annotation.Annotation],
+ () => typeOf[scala.io.BufferedSource],
+ () => typeOf[scala.io.Codec])
+ val perms = types.permutations.toList
+ def force(lazytpe: () => Type): String = {
+ lazytpe().typeSymbol.typeSignature
+ lazytpe().toString
+ }
+ val diceRolls = List.fill(n)(rng.nextInt(perms.length))
+ val threads = (1 to n) map (i => new Thread(s"Reflector-$i") {
+ override def run(): Unit = {
+ val s1 = foo("42")
+ val s2 = perms(diceRolls(i - 1)).map(x => force(x)).sorted.mkString(", ")
+ assert(s1 == "java.lang.String")
+ assert(s2 == "java.lang.annotation.Annotation, java.lang.reflect.Method, scala.io.BufferedSource, scala.io.Codec")
+ }
+ })
+ threads foreach (_.start)
+} \ No newline at end of file
diff --git a/test/pending/run/t5943b1.scala b/test/pending/run/t5943b1.scala
index 0d54718753..79c638fedc 100644
--- a/test/pending/run/t5943b1.scala
+++ b/test/pending/run/t5943b1.scala
@@ -6,5 +6,5 @@ import scala.tools.reflect.ToolBox
object Test extends App {
val tb = cm.mkToolBox()
val expr = tb.parse("math.sqrt(4.0)")
- println(tb.typeCheck(expr))
+ println(tb.typecheck(expr))
} \ No newline at end of file