diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2010-05-26 08:33:39 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2010-05-26 08:33:39 +0000 |
commit | 83630c3ce608d1acc502cfe7ab6accf90ced8a47 (patch) | |
tree | 2d1502449729cb66c0a5505ee4fbbb092329a07a /test/files | |
parent | 4e3c1a99e845dab52b6879581a4fa56737b4bccf (diff) | |
download | scala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.tar.gz scala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.tar.bz2 scala-83630c3ce608d1acc502cfe7ab6accf90ced8a47.zip |
Closes #3434.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/spec-overrides.check | 7 | ||||
-rw-r--r-- | test/files/neg/spec-overrides.scala | 26 |
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)) +} |