From e869cd34104701f8c55e19c542775679a1802edd Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 26 Feb 2008 09:50:05 +0000 Subject: fixed #520, #489 --- test/files/neg/t0528neg.check | 4 ++++ test/files/neg/t0528neg.scala | 15 +++++++++++++++ test/files/run/t0412.check | 2 ++ test/files/run/t0412.scala | 4 ++++ test/files/run/t0528.check | Bin 0 -> 47 bytes test/files/run/t0528.scala | 14 ++++++++++++++ 6 files changed, 39 insertions(+) create mode 100644 test/files/neg/t0528neg.check create mode 100644 test/files/neg/t0528neg.scala create mode 100644 test/files/run/t0412.check create mode 100644 test/files/run/t0412.scala create mode 100644 test/files/run/t0528.check create mode 100644 test/files/run/t0528.scala (limited to 'test/files') diff --git a/test/files/neg/t0528neg.check b/test/files/neg/t0528neg.check new file mode 100644 index 0000000000..c8c3ab422f --- /dev/null +++ b/test/files/neg/t0528neg.check @@ -0,0 +1,4 @@ +t0528neg.scala:2: error: covariant type A occurs in invariant position in type => Array[T forSome { type T <: A }] of method toArray + def toArray: Array[T forSome {type T <: A}] + ^ +one error found diff --git a/test/files/neg/t0528neg.scala b/test/files/neg/t0528neg.scala new file mode 100644 index 0000000000..911745b763 --- /dev/null +++ b/test/files/neg/t0528neg.scala @@ -0,0 +1,15 @@ +trait Sequ[+A] { + def toArray: Array[T forSome {type T <: A}] +} + +class RichStr extends Sequ[Char] { + // override to a primitve array + def toArray: Array[Char] = new Array[Char](10) +} + +object Foo extends Application { + val x: RichStr = new RichStr + + println(x.toArray) // call directly + println((x: Sequ[Char]).toArray) // calling through the bridge misses unboxing +} diff --git a/test/files/run/t0412.check b/test/files/run/t0412.check new file mode 100644 index 0000000000..c7141ddbd9 --- /dev/null +++ b/test/files/run/t0412.check @@ -0,0 +1,2 @@ +class java.util.ArrayList +class java.util.ArrayList diff --git a/test/files/run/t0412.scala b/test/files/run/t0412.scala new file mode 100644 index 0000000000..f1ca7379ae --- /dev/null +++ b/test/files/run/t0412.scala @@ -0,0 +1,4 @@ +object Test extends Application { + println(classOf[java.util.ArrayList[_]]) + println(classOf[java.util.ArrayList[T] forSome { type T }]) +} diff --git a/test/files/run/t0528.check b/test/files/run/t0528.check new file mode 100644 index 0000000000..b64e97a93a Binary files /dev/null and b/test/files/run/t0528.check differ diff --git a/test/files/run/t0528.scala b/test/files/run/t0528.scala new file mode 100644 index 0000000000..b00ef4fa92 --- /dev/null +++ b/test/files/run/t0528.scala @@ -0,0 +1,14 @@ +trait Sequ[A] { + def toArray: Array[T forSome {type T <: A}] +} + +class RichStr extends Sequ[Char] { + // override to a primitve array + def toArray: Array[Char] = Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9') +} + +object Test extends Application { + val x: RichStr = new RichStr + + println((x: Sequ[Char]).toArray) // calling through the bridge misses unboxing +} -- cgit v1.2.3