[FIR] Completely unwrap original argument when computing type arguments
When computing the conversion type for a type operator call, the argument needs to be fully unwrapped before getting the resolved type. This avoids the situation when the argument is a when-subject and the assumed original type is not correct. Before, only smart-casts were unwrapped, and this change will also unwrap when-subjects (as well as a few other FirExpressions). ^KT-62114 Fixed
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// ISSUE: KT-62114
|
||||
|
||||
open class A {
|
||||
class B : A() {
|
||||
val a = "FAIL"
|
||||
@@ -27,3 +29,26 @@ class C {
|
||||
else return ""
|
||||
}
|
||||
}
|
||||
|
||||
sealed class Received<out T> {
|
||||
sealed class Error<out T> : Received<T>() {
|
||||
data class SomeError<out T>(val details: T?) : Error<T>()
|
||||
}
|
||||
}
|
||||
|
||||
val Received<String>.thisRaisesUnresolvedReference: Boolean
|
||||
get() = if (this is Received.Error<*>) {
|
||||
when (<!DEBUG_INFO_SMARTCAST!>this<!>) {
|
||||
is Received.Error.SomeError -> <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>details<!>?.length == 0
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
val Received<String>.thisIsFine: Boolean
|
||||
get() = if (this is Received.Error<*>) {
|
||||
if (this is Received.Error.SomeError) { <!DEBUG_INFO_IMPLICIT_RECEIVER_SMARTCAST!>details<!>?.length == 0 }
|
||||
else false
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user