diff options
author | Martin Odersky <odersky@gmail.com> | 2008-02-26 09:50:05 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2008-02-26 09:50:05 +0000 |
commit | e869cd34104701f8c55e19c542775679a1802edd (patch) | |
tree | 80f752abc7cd116a489fdc4a9b707fa7352761da /test | |
parent | bcbeab74566f835219dabf0bbb172fd028a8a032 (diff) | |
download | scala-e869cd34104701f8c55e19c542775679a1802edd.tar.gz scala-e869cd34104701f8c55e19c542775679a1802edd.tar.bz2 scala-e869cd34104701f8c55e19c542775679a1802edd.zip |
fixed #520, #489
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t0528neg.check | 4 | ||||
-rw-r--r-- | test/files/neg/t0528neg.scala | 15 | ||||
-rw-r--r-- | test/files/run/t0412.check | 2 | ||||
-rw-r--r-- | test/files/run/t0412.scala | 4 | ||||
-rw-r--r-- | test/files/run/t0528.check | bin | 0 -> 47 bytes | |||
-rw-r--r-- | test/files/run/t0528.scala | 14 |
6 files changed, 39 insertions, 0 deletions
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 Binary files differnew file mode 100644 index 0000000000..b64e97a93a --- /dev/null +++ b/test/files/run/t0528.check 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 +} |