Native: don't report Objective-C-related errors on expect classes

An expect class might lack some details and thus seem incorrect to the
compiler, while the corresponding actual class is totally fine.
Due to the specifics of the compiler, this happens more often then it
should (because the compiler actually always analyzes expects along
with actuals, with most references actualized).

For example, in KT-52882 the compiler analyzes an expect class
(TestImpl), but the class refers to the actual interface Test as its
supertype, meaning that the compiler sees TestImpl as a class inheriting
an Objective-C protocol but not an Objective-C class, which is
prohibited. While the actual class has its super types in order.

So, in reality, from both actualized and non-actualized points of view,
the code is totally correct, and the error was reported only because of
the way the compiler handles multiplatform.

Those compiler checks only matter for the actual class anyway, so
disabling them for expect classes is harmless.

^KT-52882 Fixed
This commit is contained in:
Svyatoslav Scherbina
2023-07-10 16:15:49 +00:00
committed by Space Team
parent 6619edbbac
commit 710381e489
@@ -593,7 +593,7 @@ private class BackendChecker(
}
override fun visitClass(declaration: IrClass) {
if (declaration.isKotlinObjCClass()) {
if (!declaration.isExpect && declaration.isKotlinObjCClass()) {
checkKotlinObjCClass(declaration)
}
super.visitClass(declaration)