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:
+5
@@ -0,0 +1,5 @@
|
||||
public class JavaClass {
|
||||
public static String test() {
|
||||
return MainKt.bar(MainKt.foo());
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user