Fix wildcards for invariant arguments

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
This commit is contained in:
Denis Zharkov
2015-12-14 16:49:53 +03:00
parent 5df2a58003
commit 154657a374
7 changed files with 48 additions and 4 deletions

View File

@@ -0,0 +1,5 @@
public class JavaClass {
public static String test() {
return MainKt.bar(MainKt.foo());
}
}

View File

@@ -0,0 +1,11 @@
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();
}