summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2010-05-26 08:33:39 +0000
committerIulian Dragos <jaguarul@gmail.com>2010-05-26 08:33:39 +0000
commit83630c3ce608d1acc502cfe7ab6accf90ced8a47 (patch)
tree2d1502449729cb66c0a5505ee4fbbb092329a07a /test
parent4e3c1a99e845dab52b6879581a4fa56737b4bccf (diff)
downloadscala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.tar.gz
scala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.tar.bz2
scala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.zip
Closes #3434.
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/spec-overrides.check7
-rw-r--r--test/files/neg/spec-overrides.scala26
2 files changed, 33 insertions, 0 deletions
diff --git a/test/files/neg/spec-overrides.check b/test/files/neg/spec-overrides.check
new file mode 100644
index 0000000000..639186af40
--- /dev/null
+++ b/test/files/neg/spec-overrides.check
@@ -0,0 +1,7 @@
+spec-overrides.scala:8: error: Type parameter has to be specialized at least for the same types as in the overridden method. Missing types: Int
+ override def a[@specialized(Double) T](t: T): List[T] = Nil
+ ^
+spec-overrides.scala:12: error: Type parameter has to be specialized at least for the same types as in the overridden method. Missing types: Int
+ override def a[T](t: T): List[T] = Nil
+ ^
+two errors found
diff --git a/test/files/neg/spec-overrides.scala b/test/files/neg/spec-overrides.scala
new file mode 100644
index 0000000000..8c92b8ee25
--- /dev/null
+++ b/test/files/neg/spec-overrides.scala
@@ -0,0 +1,26 @@
+class P {
+ def a[@specialized(Int) T](t: T): List[T] = List(t)
+}
+class FX extends P {
+ override def a[@specialized(Int) T](t: T): List[T] = Nil
+}
+class FX1 extends P {
+ override def a[@specialized(Double) T](t: T): List[T] = Nil
+}
+
+class FX2 extends P {
+ override def a[T](t: T): List[T] = Nil
+}
+
+object Test extends Application {
+ val fx = new FX
+ val p = new P
+
+ println(fx.a(3))
+ println((fx: P).a(3))
+ println((fx: P).a(3.0))
+
+
+ // val d = new Derived[Int]
+ // println((d: Base[Int]).m(10))
+}