summaryrefslogtreecommitdiff
path: root/test/pending
diff options
context:
space:
mode:
Diffstat (limited to 'test/pending')
-rw-r--r--test/pending/neg/macro-invalidusage-badbounds-b/Impls_1.scala4
-rw-r--r--test/pending/neg/t2066.scala16
-rw-r--r--test/pending/pos/t6161.scala22
-rw-r--r--test/pending/pos/t8128b.scala18
-rw-r--r--test/pending/presentation/context-bounds1.check51
-rw-r--r--test/pending/presentation/context-bounds1/Test.scala3
-rw-r--r--test/pending/presentation/context-bounds1/src/ContextBounds.scala13
-rw-r--r--test/pending/run/macro-expand-default/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala2
-rw-r--r--test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-named/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala4
-rw-r--r--test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala4
-rw-r--r--test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala4
-rw-r--r--test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala2
-rw-r--r--test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala4
-rw-r--r--test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala2
-rw-r--r--test/pending/run/macro-reify-array/Macros_1.scala4
-rw-r--r--test/pending/run/macro-reify-tagful-b/Macros_1.scala4
-rw-r--r--test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala4
-rw-r--r--test/pending/run/macro-term-declared-in-anonymous-explicit-import/Impls_1.scala4
-rw-r--r--test/pending/run/reflection-sync-potpourri.scala32
22 files changed, 166 insertions, 43 deletions
diff --git a/test/pending/neg/macro-invalidusage-badbounds-b/Impls_1.scala b/test/pending/neg/macro-invalidusage-badbounds-b/Impls_1.scala
index 89020de7dd..be47d5cec4 100644
--- a/test/pending/neg/macro-invalidusage-badbounds-b/Impls_1.scala
+++ b/test/pending/neg/macro-invalidusage-badbounds-b/Impls_1.scala
@@ -1,5 +1,5 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U <: String](c: Ctx) = ???
+ def foo[U <: String](c: Context) = ???
}
diff --git a/test/pending/neg/t2066.scala b/test/pending/neg/t2066.scala
deleted file mode 100644
index 46177b19f7..0000000000
--- a/test/pending/neg/t2066.scala
+++ /dev/null
@@ -1,16 +0,0 @@
-object Test extends App {
- trait A {
- def f[T[_]](x : T[Int]) : T[Any]
- }
-
- class B extends A {
- def f[T[+_]](x : T[Int]) : T[Any] = x
- }
-
- class P[Y](var y : Y)
-
- val p = new P(1)
- val palias = (new B():A).f[P](p)
- palias.y = "hello"
- val z: Int = p.y
-} \ No newline at end of file
diff --git a/test/pending/pos/t6161.scala b/test/pending/pos/t6161.scala
new file mode 100644
index 0000000000..5783cc85f2
--- /dev/null
+++ b/test/pending/pos/t6161.scala
@@ -0,0 +1,22 @@
+object t6161 {
+ trait N {
+ type Name
+ }
+
+ trait N1 extends N {
+ class Name {
+ type ThisNameType <: Name
+ def encode: ThisNameType = ???
+ }
+ }
+
+ trait S {
+ self: N => // change to N1 and it compiles
+ type NameType <: Name
+ }
+
+ object g extends S with N1
+
+ val n1: g.NameType = ???
+ val n2: g.Name = n1.encode
+}
diff --git a/test/pending/pos/t8128b.scala b/test/pending/pos/t8128b.scala
new file mode 100644
index 0000000000..dd44a25a90
--- /dev/null
+++ b/test/pending/pos/t8128b.scala
@@ -0,0 +1,18 @@
+class Optiony[X] { def isEmpty = true; def get: X = ??? }
+class Seqy[X] { def head: X = ???; def length = 0; def apply(i: Int): X = ??? }
+
+object G {
+ def unapply(m: Any): Optiony[_] = ???
+}
+
+object H {
+ def unapplySeq(m: Any): Optiony[Seqy[_]] = ???
+}
+
+object Test {
+ (0: Any) match {
+ case G(v) => v
+ case H(v) => v
+ case _ =>
+ }
+}
diff --git a/test/pending/presentation/context-bounds1.check b/test/pending/presentation/context-bounds1.check
new file mode 100644
index 0000000000..b444de59a4
--- /dev/null
+++ b/test/pending/presentation/context-bounds1.check
@@ -0,0 +1,51 @@
+reload: ContextBounds.scala
+
+askHyperlinkPos for `Blubb` at (2,23) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `Blubb` at (13,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `Foo` at (4,17) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `Foo` at (9,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `Blubb` at (4,32) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `Blubb` at (13,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `A` at (4,42) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `A` at (4,51) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `blubb` at (4,66) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `blubb` at (2,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `Foo` at (5,18) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `Foo` at (9,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `A` at (5,25) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `A` at (4,12) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `foo` at (5,36) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `foo` at (10,7) ContextBounds.scala
+================================================================================
+
+askHyperlinkPos for `A` at (10,14) ContextBounds.scala
+================================================================================
+[response] found askHyperlinkPos for `A` at (9,11) ContextBounds.scala
+================================================================================
diff --git a/test/pending/presentation/context-bounds1/Test.scala b/test/pending/presentation/context-bounds1/Test.scala
new file mode 100644
index 0000000000..bec1131c4c
--- /dev/null
+++ b/test/pending/presentation/context-bounds1/Test.scala
@@ -0,0 +1,3 @@
+import scala.tools.nsc.interactive.tests.InteractiveTest
+
+object Test extends InteractiveTest \ No newline at end of file
diff --git a/test/pending/presentation/context-bounds1/src/ContextBounds.scala b/test/pending/presentation/context-bounds1/src/ContextBounds.scala
new file mode 100644
index 0000000000..72a8f694a3
--- /dev/null
+++ b/test/pending/presentation/context-bounds1/src/ContextBounds.scala
@@ -0,0 +1,13 @@
+object ContextBound {
+ val blubb = new Blubb/*#*/
+
+ def work[A: Foo/*#*/](f: Blubb/*#*/ => A/*#*/): A/*#*/ = f(blubb/*#*/) ensuring {
+ implicitly[Foo/*#*/[A/*#*/]].foo/*#*/(_) >= 42
+ }
+}
+
+trait Foo[A] {
+ def foo(a: A/*#*/): Int
+}
+
+class Blubb \ No newline at end of file
diff --git a/test/pending/run/macro-expand-default/Impls_1.scala b/test/pending/run/macro-expand-default/Impls_1.scala
index bb55f02ab2..fd5d8d7f18 100644
--- a/test/pending/run/macro-expand-default/Impls_1.scala
+++ b/test/pending/run/macro-expand-default/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = {
import c.universe._
val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
diff --git a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
index 15bcb581c8..e8170fda07 100644
--- a/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
+++ b/test/pending/run/macro-expand-implicit-macro-defeats-type-inference/Impls_1.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.Context
+import scala.reflect.macros.whitebox.Context
object Impls {
def foo[T: c.WeakTypeTag](c: Context): c.Expr[List[T]] = c.universe.reify {
diff --git a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
index eed68280cd..34182b7968 100644
--- a/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
+++ b/test/pending/run/macro-expand-macro-has-context-bound/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[U](c: Ctx)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = {
+ def foo[U](c: Context)(x: c.Expr[U])(evidence: c.Expr[Numeric[U]]) = {
import c.universe._
val plusOne = Apply(Select(evidence.tree, TermName("plus")), List(x.tree, Literal(Constant(1))))
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(plusOne))
diff --git a/test/pending/run/macro-expand-named/Impls_1.scala b/test/pending/run/macro-expand-named/Impls_1.scala
index bb55f02ab2..fd5d8d7f18 100644
--- a/test/pending/run/macro-expand-named/Impls_1.scala
+++ b/test/pending/run/macro-expand-named/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx)(x: c.Expr[Int], y: c.Expr[Int]) = {
+ def foo(c: Context)(x: c.Expr[Int], y: c.Expr[Int]) = {
import c.universe._
val sum = Apply(Select(x.tree, TermName("$minus")), List(y.tree))
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(sum))
diff --git a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
index 487ac79673..683622b29d 100644
--- a/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-e1/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
Block(List(
Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
diff --git a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
index 487ac79673..683622b29d 100644
--- a/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
+++ b/test/pending/run/macro-expand-tparams-prefix-f1/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo[T, U: c.WeakTypeTag, V](c: Ctx)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
+ def foo[T, U: c.WeakTypeTag, V](c: Context)(implicit T: c.WeakTypeTag[T], V: c.WeakTypeTag[V]): c.Expr[Unit] = {
import c.universe._
Block(List(
Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(T.toString)))),
diff --git a/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala
index daedde4021..741a921b72 100644
--- a/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala
+++ b/test/pending/run/macro-quasiinvalidbody-a/Impls_1.scala
@@ -1,5 +1,5 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
trait Impls {
- def impl(c: Ctx)(x: c.Expr[Any]) = x
+ def impl(c: Context)(x: c.Expr[Any]) = x
} \ No newline at end of file
diff --git a/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala
index 27140a77ad..2735321eae 100644
--- a/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala
+++ b/test/pending/run/macro-quasiinvalidbody-a/Macros_Test_2.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros extends Impls {
def foo(x: Any) = macro impl
diff --git a/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala
index 246fc9f904..b023d31f05 100644
--- a/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala
+++ b/test/pending/run/macro-quasiinvalidbody-b/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
trait ImplContainer {
object Impls {
- def foo(c: Ctx)(x: c.Expr[Any]) = x
+ def foo(c: Context)(x: c.Expr[Any]) = x
}
} \ No newline at end of file
diff --git a/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala
index da9445ac52..639d93fb5f 100644
--- a/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala
+++ b/test/pending/run/macro-quasiinvalidbody-b/Macros_Test_2.scala
@@ -1,4 +1,4 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros extends ImplContainer {
def foo(x: Any) = macro Impls.foo
diff --git a/test/pending/run/macro-reify-array/Macros_1.scala b/test/pending/run/macro-reify-array/Macros_1.scala
index f970be5caa..eea0133feb 100644
--- a/test/pending/run/macro-reify-array/Macros_1.scala
+++ b/test/pending/run/macro-reify-array/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: String) = macro Impls.foo[T]
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Context)(s: c.Expr[T]) = c.universe.reify {
Array(s.splice)
}
}
diff --git a/test/pending/run/macro-reify-tagful-b/Macros_1.scala b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
index 59dbe7157b..f4d8062a14 100644
--- a/test/pending/run/macro-reify-tagful-b/Macros_1.scala
+++ b/test/pending/run/macro-reify-tagful-b/Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[List[T]]
object Impls {
- def foo[T: c.WeakTypeTag](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T: c.WeakTypeTag](c: Context)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
index a581c47026..1307052394 100644
--- a/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
+++ b/test/pending/run/macro-reify-tagless-b/Impls_Macros_1.scala
@@ -1,10 +1,10 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Macros {
def foo[T](s: T) = macro Impls.foo[List[T]]
object Impls {
- def foo[T](c: Ctx)(s: c.Expr[T]) = c.universe.reify {
+ def foo[T](c: Context)(s: c.Expr[T]) = c.universe.reify {
List(s.splice)
}
}
diff --git a/test/pending/run/macro-term-declared-in-anonymous-explicit-import/Impls_1.scala b/test/pending/run/macro-term-declared-in-anonymous-explicit-import/Impls_1.scala
index 348f3420f2..c43f5f3f53 100644
--- a/test/pending/run/macro-term-declared-in-anonymous-explicit-import/Impls_1.scala
+++ b/test/pending/run/macro-term-declared-in-anonymous-explicit-import/Impls_1.scala
@@ -1,7 +1,7 @@
-import scala.reflect.macros.{Context => Ctx}
+import scala.reflect.macros.blackbox.Context
object Impls {
- def foo(c: Ctx) = {
+ def foo(c: Context) = {
import c.{prefix => prefix}
import c.universe._
val printPrefix = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant("prefix = " + prefix))))
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