mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 15:53:40 +00:00
See test with Java, we want preserve the invariant that if return type and value parameter types are same in Kotlin, than we can use such return-value as argument for that parameter
12 lines
277 B
Kotlin
Vendored
12 lines
277 B
Kotlin
Vendored
class Pair<out X, out Y>(val x: X, val y: Y)
|
|
|
|
class Inv<T>(val x: T)
|
|
|
|
fun foo(): Inv<Pair<CharSequence, CharSequence>> = Inv(Pair("O", "K"))
|
|
|
|
fun bar(inv: Inv<Pair<CharSequence, CharSequence>>) = inv.x.x.toString() + inv.x.y
|
|
|
|
fun box(): String {
|
|
return JavaClass.test();
|
|
}
|