mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 08:31:30 +00:00
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
21 lines
264 B
Kotlin
Vendored
21 lines
264 B
Kotlin
Vendored
// 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
|
|
}
|