diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t0528neg.check | 4 | ||||
-rw-r--r-- | test/files/neg/t0528neg.scala | 15 |
2 files changed, 19 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 +} |