Use flexible upper bound of parameter's type for vararg argument

See the issue and the test. The problem was that when generating
call to `foo` method in member scope of `AT<*>` its resulting descriptor
after substitution and approximation was: fun foo(x: Nothing..Array<out Nothing>).

This signature is correct, but when using this parameter type
for generating a vararg argument the assertion is violated that
the type of the argument must be an array
(by default we're using lower flexible bound everywhere)

The solution is using upper bound for flexible types that should
always have a form of Array<out T> for varargs (even for such corner cases)
both for Kotlin and Java declarations.

 #KT-14607 Fixed
This commit is contained in:
Denis Zharkov
2017-02-27 13:17:58 +03:00
parent 14dad61fe5
commit 9e03b712de
6 changed files with 47 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
// FILE: AT.java
public class AT<G> {
public String result = "fail";
public void foo(G ...y) {
result = "OK";
}
}
// FILE: main.kt
fun AT<*>.bar() {
foo()
}
fun box(): String {
val a = AT<String>()
a.bar()
return a.result
}