summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/run/macro-vampire-false-warning/Macros_1.scala4
-rw-r--r--test/files/run/reflection-java-annotations.check3
-rw-r--r--test/files/run/reflection-java-annotations/Test_2.scala2
-rw-r--r--test/files/run/reflection-scala-annotations.check7
-rw-r--r--test/files/run/reflection-scala-annotations.scala16
-rw-r--r--test/files/run/t6860.scala2
-rw-r--r--test/files/run/t8190.check4
-rw-r--r--test/files/run/t8190.scala12
8 files changed, 35 insertions, 15 deletions
diff --git a/test/files/run/macro-vampire-false-warning/Macros_1.scala b/test/files/run/macro-vampire-false-warning/Macros_1.scala
index 0912bfba0c..51869d214f 100644
--- a/test/files/run/macro-vampire-false-warning/Macros_1.scala
+++ b/test/files/run/macro-vampire-false-warning/Macros_1.scala
@@ -10,8 +10,8 @@ object Macros {
def selFieldImpl(c: Context) = {
import c.universe._
val field = c.macroApplication.symbol
- val bodyAnn = field.annotations.filter(_.tpe <:< typeOf[body]).head
- c.Expr[Any](bodyAnn.scalaArgs.head)
+ val bodyAnn = field.annotations.filter(_.tree.tpe <:< typeOf[body]).head
+ c.Expr[Any](bodyAnn.tree.children(1))
}
def mkObjectImpl(c: Context)(xs: c.Expr[Any]*) = {
diff --git a/test/files/run/reflection-java-annotations.check b/test/files/run/reflection-java-annotations.check
index 2d37fff1f4..72d40989fe 100644
--- a/test/files/run/reflection-java-annotations.check
+++ b/test/files/run/reflection-java-annotations.check
@@ -1 +1,4 @@
+warning: there were 1 deprecation warning(s); re-run with -deprecation for details
List(JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = [101, 101], v102 = [102, 102], v103 = ['g', 'g'], v104 = [104, 104], v105 = [105L, 105L], v106 = [106.0, 106.0], v107 = [107.0, 107.0], v108 = [false, true], v11 = classOf[JavaAnnottee_1], v110 = ["hello", "world"], v111 = [classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]], v112 = [FOO, BAR], v113 = [JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)], v12 = FOO, v13 = JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false))
+=======
+new JavaComplexAnnotation_1(v1 = 1, v10 = "hello", v101 = Array(101, 101), v102 = Array(102, 102), v103 = Array('g', 'g'), v104 = Array(104, 104), v105 = Array(105L, 105L), v106 = Array(106.0, 106.0), v107 = Array(107.0, 107.0), v108 = Array(false, true), v11 = classOf[JavaAnnottee_1], v110 = Array("hello", "world"), v111 = Array(classOf[JavaSimpleAnnotation_1], classOf[JavaComplexAnnotation_1]), v112 = Array(FOO, BAR), v113 = Array(new JavaSimpleAnnotation_1(v1 = 21, v10 = "world2", v11 = classOf[JavaComplexAnnotation_1], v12 = BAR, v2 = 22, v3 = '\027', v4 = 24, v5 = 25L, v6 = 26.0, v7 = 27.0, v8 = false)), v12 = FOO, v13 = new JavaSimpleAnnotation_1(v1 = 11, v10 = "world1", v11 = classOf[JavaSimpleAnnotation_1], v12 = FOO, v2 = 12, v3 = '\r', v4 = 14, v5 = 15L, v6 = 16.0, v7 = 17.0, v8 = false), v2 = 2, v3 = '\03', v4 = 4, v5 = 5L, v6 = 6.0, v7 = 7.0, v8 = false)
diff --git a/test/files/run/reflection-java-annotations/Test_2.scala b/test/files/run/reflection-java-annotations/Test_2.scala
index d2c3157071..5c9e9afdb7 100644
--- a/test/files/run/reflection-java-annotations/Test_2.scala
+++ b/test/files/run/reflection-java-annotations/Test_2.scala
@@ -4,4 +4,6 @@ object Test extends App {
sym.typeSignature
sym.annotations foreach (_.javaArgs)
println(sym.annotations)
+ println("=======")
+ sym.annotations.map(_.tree).map(println)
} \ No newline at end of file
diff --git a/test/files/run/reflection-scala-annotations.check b/test/files/run/reflection-scala-annotations.check
new file mode 100644
index 0000000000..5bc2786161
--- /dev/null
+++ b/test/files/run/reflection-scala-annotations.check
@@ -0,0 +1,7 @@
+reflection-scala-annotations.scala:5: warning: Implementation restriction: subclassing Classfile does not
+make your annotation visible at runtime. If that is what
+you want, you must write the annotation class in Java.
+class jann(x: Int, y: Array[Int]) extends ClassfileAnnotation
+ ^
+new sann(1, immutable.this.List.apply[Int](1, 2))
+new jann(y = Array(1, 2), x = 2)
diff --git a/test/files/run/reflection-scala-annotations.scala b/test/files/run/reflection-scala-annotations.scala
new file mode 100644
index 0000000000..f6a6895ee0
--- /dev/null
+++ b/test/files/run/reflection-scala-annotations.scala
@@ -0,0 +1,16 @@
+import scala.reflect.runtime.universe._
+import scala.annotation._
+
+class sann(x: Int, y: List[Int]) extends StaticAnnotation
+class jann(x: Int, y: Array[Int]) extends ClassfileAnnotation
+
+@sann(1, List(1, 2))
+class S
+
+@jann(y = Array(1, 2), x = 2)
+class J
+
+object Test extends App {
+ println(symbolOf[S].annotations.head.tree)
+ println(symbolOf[J].annotations.head.tree)
+}
diff --git a/test/files/run/t6860.scala b/test/files/run/t6860.scala
index 2dcc2a67f7..1391af3430 100644
--- a/test/files/run/t6860.scala
+++ b/test/files/run/t6860.scala
@@ -13,7 +13,7 @@ object Test {
def main(args: Array[String]): Unit = {
val members = typeOf[A].declarations.toList
- val tpes = members flatMap (_.annotations) map (_.tpe)
+ val tpes = members flatMap (_.annotations) map (_.tree.tpe)
tpes.map(_.toString).sorted foreach println
}
diff --git a/test/files/run/t8190.check b/test/files/run/t8190.check
index 2362af7320..d117bf3294 100644
--- a/test/files/run/t8190.check
+++ b/test/files/run/t8190.check
@@ -1,8 +1,4 @@
Annotation
-JavaArgument
-LiteralArgument
-ArrayArgument
-NestedArgument
Constant
Mirror
Name
diff --git a/test/files/run/t8190.scala b/test/files/run/t8190.scala
index f8abb73f15..012d0ad347 100644
--- a/test/files/run/t8190.scala
+++ b/test/files/run/t8190.scala
@@ -4,10 +4,6 @@ trait Overloads {
// makes sure noone erases to Any or AnyRef
def test(x: AnyRef) = "AnyRef"
def test(x: Annotation) = "Annotation"
- def test(x: JavaArgument) = "JavaArgument"
- def test(x: LiteralArgument) = "LiteralArgument"
- def test(x: ArrayArgument) = "ArrayArgument"
- def test(x: NestedArgument) = "NestedArgument"
def test(x: Constant) = "Constant"
def test(x: Mirror) = "Mirror"
def test(x: Name) = "Name"
@@ -110,14 +106,14 @@ object Test extends App with Overloads {
types = types.filter(_ != "ModifiersCreator") // type ModifiersCreator = ModifiersExtractor
types = types.filter(_ != "FlagSet") // type FlagSet
types = types.filter(_ != "RuntimeClass") // type RuntimeClass = java.lang.Class[_]
+ types = types.filter(_ != "JavaArgument") // deprecated
+ types = types.filter(_ != "LiteralArgument") // deprecated
+ types = types.filter(_ != "ArrayArgument") // deprecated
+ types = types.filter(_ != "NestedArgument") // deprecated
val diff = types.toList diff buf.toList
println("uncovered type members: " + diff)
}
record(test(null: Annotation))
- record(test(null: JavaArgument))
- record(test(null: LiteralArgument))
- record(test(null: ArrayArgument))
- record(test(null: NestedArgument))
record(test(null: Constant))
record(test(null: Mirror))
record(test(null: Name))