blob: 911745b763358a71de00475493ca9d6eab29e96f (
plain) (
tree)
|
|
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
}
|