K2: add explicit cast to Any for Any function calls on stub types
This commit solves a stub type inconsistency problem.
As a part of KT-59369 fix we decided (see commit 299d2799),
that ConeStubTypeForChainInference has a scope of Any,
so we can safely resolve only to equals/hashCode/toString.
However, later we can replace a stub type with some inferred type,
which can have its own equals/hashCode/toString implementation,
while the call still refers Any member.
In this situation FIR2IR decides that we are calling a fake override,
which is not true, in fact we are calling an overriding method.
This leads to a crash in Native backend.
To solve this situation, we provide an explicit cast of a dispatch
receiver with a stub type (ConeStubTypeForChainInference) to Any,
thus confirming directly we are calling Any method and nothing else.
#KT-63932 Fixed
This commit is contained in:
committed by
Space Team
parent
a0deaea8fe
commit
dbca7358af
@@ -291,6 +291,9 @@ sealed class KtFakeSourceElementKind(final override val shouldSkipErrorTypeRepor
|
||||
|
||||
// When a lambda is converted to a SAM type, the expression is wrapped in an extra node
|
||||
object SamConversion : KtFakeSourceElementKind()
|
||||
|
||||
// For it.functionFromAny() calls on a stub type
|
||||
object CastToAnyForStubTypes : KtFakeSourceElementKind()
|
||||
}
|
||||
|
||||
sealed class AbstractKtSourceElement {
|
||||
|
||||
Reference in New Issue
Block a user