55a58e54fe
The only case when behavior is change is described at computeNonTrivialTypeArgumentForScopeSubstitutor The idea is to avoid depending on the presence of @UnsafeVariance and instead approximate captured types in covariant argument positions before building substitution scopes It's correct because for Captured(*) <: Supertype, Out<Captured(*)> <: Out<Supertype> and when we've got @UnsafeVariance value parameters at Out, it's ok to allow passing Supertype there. ^KT-57602 Fixed ^KT-54894 Fixed
14 lines
235 B
Kotlin
Vendored
14 lines
235 B
Kotlin
Vendored
// ISSUE: KT-54764
|
|
|
|
data class Out<out T>(val prop: T)
|
|
|
|
fun foo(b: Out<*>) {
|
|
b.copy(<!TYPE_MISMATCH!>""<!>) // error in K1, OK in K2
|
|
}
|
|
|
|
fun foo(a: Any) {
|
|
if (a is Out<*>) {
|
|
<!DEBUG_INFO_SMARTCAST!>a<!>.copy("")
|
|
}
|
|
}
|