diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-18 22:55:34 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-18 23:48:26 -0800 |
commit | ec160bae7e2935d98bf71cfb6dcba61f1979b854 (patch) | |
tree | 11ed857d21aaac691481e12eabfc53a4446065d4 /test/files/run | |
parent | 0d19fe04eb43d39bdceab570fb5400a3a4b072ea (diff) | |
download | scala-ec160bae7e2935d98bf71cfb6dcba61f1979b854.tar.gz scala-ec160bae7e2935d98bf71cfb6dcba61f1979b854.tar.bz2 scala-ec160bae7e2935d98bf71cfb6dcba61f1979b854.zip |
More on SI-5500.
A reimagining of erik's patch in 1df4fc6e59 . He did the hard
part, this is the batman reboot. I added more tests and tried
to make the anyref caching code less fragile.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t5488-fn.check | 10 | ||||
-rw-r--r-- | test/files/run/t5488-fn.scala | 26 | ||||
-rw-r--r-- | test/files/run/t5500b.check | 28 | ||||
-rw-r--r-- | test/files/run/t5500b.scala | 51 |
4 files changed, 86 insertions, 29 deletions
diff --git a/test/files/run/t5488-fn.check b/test/files/run/t5488-fn.check index 196f58d063..18907d0ab8 100644 --- a/test/files/run/t5488-fn.check +++ b/test/files/run/t5488-fn.check @@ -1,17 +1,17 @@ B$mcII$sp -B +B$mcIL$sp B$mcIV$sp B$mcLI$sp B B$mcLV$sp B$mcVI$sp -B +B$mcVL$sp B$mcVV$sp C$mcIII$sp -C +C$mcIIL$sp C$mcILI$sp -C +C$mcILL$sp C$mcLII$sp -C +C$mcLIL$sp C$mcLLI$sp C diff --git a/test/files/run/t5488-fn.scala b/test/files/run/t5488-fn.scala index 9e4f60002b..d17bcf90a5 100644 --- a/test/files/run/t5488-fn.scala +++ b/test/files/run/t5488-fn.scala @@ -1,8 +1,5 @@ -class B[@specialized(Int, AnyRef, Unit) A, @specialized(Int, Unit) B](f: A => B) -class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(Int) C](f: (A, B) => C) -// Not yet: -// class B[@specialized(Int, AnyRef, Unit) A, @specialized(Int, AnyRef, Unit) B](f: A => B) -// class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(Int, AnyRef) C](f: (A, B) => C) +class B[@specialized(Int, AnyRef, Unit) A, @specialized(Int, AnyRef, Unit) B](f: A => B) +class C[@specialized(Int, AnyRef) A, @specialized(Int, AnyRef) B, @specialized(Int, AnyRef) C](f: (A, B) => C) object Test { def main(args:Array[String]) { @@ -28,22 +25,3 @@ object Test { show(new C((x: AnyRef, y: AnyRef) => "abc")) } } -/** If the return types are specialized on AnyRef as well: - -files/run/t5488-fn.scala:18: error: type mismatch; - found : Unit => String - required: Unit => B$sp - show(new B((x: Unit) => "abc")) - ^ -files/run/t5488-fn.scala:24: error: type mismatch; - found : (Int, Object) => String - required: (Int, B$sp) => C$sp - show(new C((x: Int, y: AnyRef) => "abc")) - ^ -files/run/t5488-fn.scala:26: error: type mismatch; - found : (Object, Int) => String - required: (A$sp, Int) => C$sp - show(new C((x: AnyRef, y: Int) => "abc")) - ^ -three errors found -**/ diff --git a/test/files/run/t5500b.check b/test/files/run/t5500b.check new file mode 100644 index 0000000000..4259b24b53 --- /dev/null +++ b/test/files/run/t5500b.check @@ -0,0 +1,28 @@ +C1A$mcLI$sp +C1A$mcLD$sp +C1A +C1A$mcII$sp +C1A$mcID$sp +C1A$mcIL$sp +C1A$mcDI$sp +C1A$mcDD$sp +C1A$mcDL$sp +C1B$mcLI$sp +C1B$mcLD$sp +C1B +C1B$mcII$sp +C1B$mcID$sp +C1B$mcIL$sp +C1B$mcDI$sp +C1B$mcDD$sp +C1B$mcDL$sp +C1C$mcLI$sp +C1C$mcLI$sp +C1C$mcLD$sp +C1C +C1C$mcII$sp +C1C$mcID$sp +C1C$mcIL$sp +C1C$mcDI$sp +C1C$mcDD$sp +C1C$mcDL$sp diff --git a/test/files/run/t5500b.scala b/test/files/run/t5500b.scala new file mode 100644 index 0000000000..32de858e7b --- /dev/null +++ b/test/files/run/t5500b.scala @@ -0,0 +1,51 @@ +import scala.{specialized => spec} + +class C1A[ + @spec(Double, Int, AnyRef) A, + @spec(Double, Int, AnyRef) B +] + +class C1B[ + @spec(Double, Int, AnyRef) A, + @spec(Double, Int, AnyRef) B +](v: A) + +class C1C[ + @spec(Double, Int, AnyRef) A, + @spec(Double, Int, AnyRef) B +](v:A, w:B) + +object Test { + def main(args:Array[String]) { + println(new C1A[String, Int].getClass.getName) + println(new C1A[String, Double].getClass.getName) + println(new C1A[String, String].getClass.getName) + println(new C1A[Int, Int].getClass.getName) + println(new C1A[Int, Double].getClass.getName) + println(new C1A[Int, String].getClass.getName) + println(new C1A[Double, Int].getClass.getName) + println(new C1A[Double, Double].getClass.getName) + println(new C1A[Double, String].getClass.getName) + + println(new C1B[String, Int]("abc").getClass.getName) + println(new C1B[String, Double]("abc").getClass.getName) + println(new C1B[String, String]("abc").getClass.getName) + println(new C1B[Int, Int](1).getClass.getName) + println(new C1B[Int, Double](1).getClass.getName) + println(new C1B[Int, String](1).getClass.getName) + println(new C1B[Double, Int](1d).getClass.getName) + println(new C1B[Double, Double](1d).getClass.getName) + println(new C1B[Double, String](1d).getClass.getName) + + println(new C1C("abc", 123).getClass.getName) + println(new C1C("abc", 123).getClass.getName) + println(new C1C("a", 1d).getClass.getName) + println(new C1C("a", "a").getClass.getName) + println(new C1C(1, 1).getClass.getName) + println(new C1C(1, 1d).getClass.getName) + println(new C1C(1, "a").getClass.getName) + println(new C1C(1d, 1).getClass.getName) + println(new C1C(1d, 1d).getClass.getName) + println(new C1C(1d, "a").getClass.getName) + } +} |