[FIR] Fix stackoverflow when checking for type cast erasure
#KT-59478 Fixed
This commit is contained in:
+1
-1
@@ -128,7 +128,7 @@ fun isCastErased(supertype: ConeKotlinType, subtype: ConeKotlinType, context: Ch
|
||||
}
|
||||
|
||||
// cast between T and T? is always OK
|
||||
if (supertype.isMarkedNullable || subtype.isMarkedNullable) {
|
||||
if ((supertype !is ConeErrorType && supertype.isMarkedNullable) || (subtype !is ConeErrorType && subtype.isMarkedNullable)) {
|
||||
return isCastErased(
|
||||
supertype.withNullability(ConeNullability.NOT_NULL, typeContext),
|
||||
subtype.withNullability(ConeNullability.NOT_NULL, typeContext),
|
||||
|
||||
@@ -3,4 +3,9 @@ class P
|
||||
fun foo(p: P): Any {
|
||||
val v = p as <!UNRESOLVED_REFERENCE!>G<!>
|
||||
return v
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(p: P): Any {
|
||||
val v = p as <!UNRESOLVED_REFERENCE!>G<!>?
|
||||
return v
|
||||
}
|
||||
|
||||
@@ -3,4 +3,9 @@ class P
|
||||
fun foo(p: P): Any {
|
||||
val v = p as <!UNRESOLVED_REFERENCE!>G<!>
|
||||
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>v<!>
|
||||
}
|
||||
}
|
||||
|
||||
fun bar(p: P): Any {
|
||||
val v = p as <!UNRESOLVED_REFERENCE!>G<!>?
|
||||
return <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>v<!>
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package
|
||||
|
||||
public fun bar(/*0*/ p: P): kotlin.Any
|
||||
public fun foo(/*0*/ p: P): kotlin.Any
|
||||
|
||||
public final class P {
|
||||
|
||||
Reference in New Issue
Block a user