blob: 30d20c95b177dfa41bb0c02693481272490e926b (
plain) (
tree)
|
|
trait Sequ[+A] {
def toArray: Array[T forSome {type T <: A}]
}
class RichStr extends Sequ[Char] {
// override to a primitive 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
}
|