summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-05-30 18:10:21 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-05-30 18:10:21 +0000
commitc6cf4fc02204d20f792bd493641d8ccd12421800 (patch)
treea8827ab270cf77a1c5f36a48a8cf125e1bcfb8c3 /test
parentab9381b4539097205d19df235f8cc3a5b2349e95 (diff)
downloadscala-c6cf4fc02204d20f792bd493641d8ccd12421800.tar.gz
scala-c6cf4fc02204d20f792bd493641d8ccd12421800.tar.bz2
scala-c6cf4fc02204d20f792bd493641d8ccd12421800.zip
big overhaul of annotations implementation.
Diffstat (limited to 'test')
-rw-r--r--test/files/jvm/annotations.scala9
-rw-r--r--test/files/neg/annot-nonconst.check4
-rw-r--r--test/files/neg/annot-nonconst.scala2
-rw-r--r--test/files/neg/bug935.check2
-rw-r--r--test/files/pos/annotations.scala3
-rw-r--r--test/files/pos/t1147.scala2
-rw-r--r--test/files/run/docgenerator.scala12
-rw-r--r--test/files/run/t1500.scala2
-rw-r--r--test/files/run/t1501.scala2
9 files changed, 20 insertions, 18 deletions
diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala
index 9af2d333ba..4a3e54791e 100644
--- a/test/files/jvm/annotations.scala
+++ b/test/files/jvm/annotations.scala
@@ -67,10 +67,11 @@ public class Main {
*/
object Test4 {
import test.SourceAnnotation // defined in SourceAnnotation.java
- @SourceAnnotation{val value = "http://scala-lang.org",
- val mails = Array("scala@lists.epfl.ch", "scala-lounge@lists.epfl.ch")}
+ @SourceAnnotation(value = "http://scala-lang.org",
+ mails = Array("scala@lists.epfl.ch", "scala-lounge@lists.epfl.ch"))
class Foo1
- @SourceAnnotation("http://bloodsuckers.com") { val mails = Array("you@bloodsuckers.com") }
+ @SourceAnnotation(value = "http://bloodsuckers.com",
+ mails = Array("you@bloodsuckers.com"))
class Foo2
@SourceAnnotation("http://bloodsuckers.com")
class Foo3
@@ -82,7 +83,7 @@ object Test4 {
@SourceAnnotation("file:///dev/zero")
def bar: Int = 0
}
- class Foo6 @SourceAnnotation("primary constructor")(s: String) {
+ class Foo6 @SourceAnnotation("primary constructor") (s: String) {
// to guarantee that primary constructor annotations
// are not applied to secondary constructors
def this() = this("")
diff --git a/test/files/neg/annot-nonconst.check b/test/files/neg/annot-nonconst.check
index ef1a72adf2..bc6a0d2c48 100644
--- a/test/files/neg/annot-nonconst.check
+++ b/test/files/neg/annot-nonconst.check
@@ -1,9 +1,9 @@
annot-nonconst.scala:1: 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 Length(n: Int) extends ClassfileAnnotation
+class Length(value: Int) extends ClassfileAnnotation
^
-annot-nonconst.scala:5: error: attribute argument needs to be a constant; found: Test.this.n
+annot-nonconst.scala:5: error: annotation argument needs to be a constant; found: n
@Length(n) def foo = "foo"
^
one warning found
diff --git a/test/files/neg/annot-nonconst.scala b/test/files/neg/annot-nonconst.scala
index 5a0b72aca2..f9d044a041 100644
--- a/test/files/neg/annot-nonconst.scala
+++ b/test/files/neg/annot-nonconst.scala
@@ -1,4 +1,4 @@
-class Length(n: Int) extends ClassfileAnnotation
+class Length(value: Int) extends ClassfileAnnotation
object Test {
def n = 15
diff --git a/test/files/neg/bug935.check b/test/files/neg/bug935.check
index 505b82ea15..63b267964b 100644
--- a/test/files/neg/bug935.check
+++ b/test/files/neg/bug935.check
@@ -1,6 +1,6 @@
bug935.scala:5: error: type arguments [Test3.B] do not conform to class E's type parameter bounds [T <: String]
@E[B](new B) val b = "hi"
- ^
+ ^
bug935.scala:11: error: type arguments [Test4.B] do not conform to class E's type parameter bounds [T <: String]
val b: String @E[B](new B) = "hi"
^
diff --git a/test/files/pos/annotations.scala b/test/files/pos/annotations.scala
index 4e2bc6a9eb..9f780c0094 100644
--- a/test/files/pos/annotations.scala
+++ b/test/files/pos/annotations.scala
@@ -5,7 +5,8 @@ object Test {
// bug #1028
val x = 1
@ann(x) val a = ()
- @ann({val y = 2; y}) val b = ()
+ @ann({val yy = 2; yy}) val b = ()
+ val bb: Int @ann({val yy = 2; yy}) = 10
def c: Int @ann(x) = 1
def d: String @ann({val z = 0; z - 1}) = "2"
diff --git a/test/files/pos/t1147.scala b/test/files/pos/t1147.scala
index e320571b24..d4b3967ddd 100644
--- a/test/files/pos/t1147.scala
+++ b/test/files/pos/t1147.scala
@@ -1,5 +1,5 @@
class App(arg: String) {
- @deprecated def this() {
+ @deprecated("..") def this() {
this("foo")
}
}
diff --git a/test/files/run/docgenerator.scala b/test/files/run/docgenerator.scala
index e3f724a603..f3738f4fc0 100644
--- a/test/files/run/docgenerator.scala
+++ b/test/files/run/docgenerator.scala
@@ -51,25 +51,25 @@ object Test {
val code ="""
package annots
-@deprecated
+@deprecated("msg")
object Foo { val x = 0 }
-@deprecated
+@deprecated("msg")
class Bar { val x = 1 }
object Foo1 {
- @deprecated
+ @deprecated("msg")
object Foo11 { val x = 3 }
}
class Bar1 {
- @deprecated
+ @deprecated("msg")
object Foo11 { val x = 2 }
}
class Bar2 {
def bar {
- @deprecated
+ @deprecated("msg")
object Foo21 { val x = 4 }
()
}
@@ -77,7 +77,7 @@ class Bar2 {
object Foo2 {
def foo {
- @deprecated
+ @deprecated("msg")
object Foo21 { val x = 5 }
()
}
diff --git a/test/files/run/t1500.scala b/test/files/run/t1500.scala
index a2f4192130..58adea221c 100644
--- a/test/files/run/t1500.scala
+++ b/test/files/run/t1500.scala
@@ -29,7 +29,7 @@ object Test {
/** Check annotations to decide whether tpe1 <:< tpe2 */
def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
- tpe1.attributes.forall(a1 => tpe2.attributes.forall(a2 => a1.atp <:< a2.atp))
+ tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
}
}
diff --git a/test/files/run/t1501.scala b/test/files/run/t1501.scala
index 07190a3b2c..2a29a6c5a5 100644
--- a/test/files/run/t1501.scala
+++ b/test/files/run/t1501.scala
@@ -40,7 +40,7 @@ object Test {
/** Check annotations to decide whether tpe1 <:< tpe2 */
def annotationsConform(tpe1: Type, tpe2: Type): Boolean = {
- tpe1.attributes.forall(a1 => tpe2.attributes.forall(a2 => a1.atp <:< a2.atp))
+ tpe1.annotations.forall(a1 => tpe2.annotations.forall(a2 => a1.atp <:< a2.atp))
}
}