Workaround inconsistent descriptor for Any.hashCode in ObjCExport

Recent changes to IR (adopted in https://github.com/JetBrains/kotlin-native/pull/4621)
have broken some invariants Native backend relies on, in particular now 
`hashCodeIrFunction.descriptor.containingDeclaration` is not `builtIns.any`,
but is an "IR-based" descriptor which has same fq name.
This breaks ObjCExport's predicate detecting `hashCode`
(which in turn breaks `interop_objc_smoke` test in two-stage mode).
This commit doesn't fix the invariants, but workarounds the problem by making the predicate more flexible.
This commit is contained in:
SvyatoslavScherbina
2021-01-13 12:28:24 +03:00
committed by Nikolay Krasko
parent 1222b72dcd
commit 37bcd0894f
@@ -265,7 +265,8 @@ private fun ObjCExportMapper.bridgeReturnType(
}
}
descriptor.containingDeclaration == descriptor.builtIns.any && descriptor.name.asString() == "hashCode" -> {
descriptor.containingDeclaration.let { it is ClassDescriptor && KotlinBuiltIns.isAny(it) } &&
descriptor.name.asString() == "hashCode" -> {
assert(!convertExceptionsToErrors)
MethodBridge.ReturnValue.HashCode
}