Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/problems/smartcastToStarProjectedSubclass.kt
T
Kirill Rakhman 251827c9aa [FIR] Don't approximate captured types
This fixes some type argument mismatch errors caused by a captured type
being approximated and then captured again.
Some places need to be adapted to work with captured types that
previously only worked with approximated types.

#KT-62959 Fixed
2024-01-17 08:20:05 +00:00

29 lines
834 B
Kotlin
Vendored

// WITH_STDLIB
// ISSUE: KT-56722
// FILE: Option.java
public interface Option<T> {
T get();
public final class Some<T> implements Option<T> {
@Override
public T get() {
return null;
}
}
}
// FILE: test.kt
fun test_1(option: Option<Pair<String, String>>?) {
if (option is Option.Some<*>) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("CapturedType(*)!! & kotlin.Pair<kotlin.String, kotlin.String>..CapturedType(*)? & kotlin.Pair<kotlin.String, kotlin.String>?")!>option.get()<!>.first
x.length
}
}
fun test_2(option: Option<Pair<String, String>>?) {
if (option is Option.Some) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Pair<kotlin.String, kotlin.String>..kotlin.Pair<kotlin.String, kotlin.String>?!")!>option.get()<!>.first
x.length
}
}