package variance abstract class Consumer {} abstract class Producer {} abstract class Usual {} fun foo(c: Consumer, p: Producer, u: Usual) { val c1: Consumer = c val c2: Consumer = c1 val p1: Producer = p val p2: Producer = p1 val u1: Usual = u val u2: Usual = u1 } //Arrays copy example class Array(val length : Int, val t : T) { fun get(index : Int) : T { return t } fun set(index : Int, value : T) { /* ... */ } } fun copy1(from : Array, to : Array) {} fun copy2(from : Array, to : Array) {} fun copy3(from : Array, to : Array) {} fun copy4(from : Array, to : Array) {} fun f(ints: Array, any: Array, numbers: Array) { copy1(ints, any) copy2(ints, any) //ok copy2(ints, numbers) copy3(ints, numbers) copy4(ints, numbers) //ok }