Casting an argument for a function call with more than one generic bound (casting with additional bounds)

Viewed 21
// a function that accepts an argument that should be both Param & Writable
fun <T : Param> write(value: T)
            where T : Writable = Unit

val v: Any = ... // some object

if(v is Param && v is Writable){
    write(v) <-- doesn't compile
}

something like Java 8

write((Param & Writable) o);

Is it possible to invoke a function like that, even skipping type check?

0 Answers
Related