bc5180656d
It should have been WeakIncompatible from the beginning because it's not possible to overload by return type in Kotlin This commit is a step forward to fix KT-62591 Unfortunately, the test cannot demonstrate the problem because of another bug in K2 KT-59887 ^KT-62752 Fixed Review: https://jetbrains.team/p/kt/reviews/12750/timeline Motivation: It makes expect-actual matching-checking model more consistent. expect-actual "matching" is run before FirResolvePhase.BODY_RESOLVE. You can't know return types, until you run BODY_RESOLVE. That's why the return type can't be checked during expect-actual matching. But it's cursed: you have something that have to match by, but, at the same time, you can't do it. expect-actual "checking" is run after FirResolvePhase.BODY_RESOLVE. That's why if we convert ReturnType incompatibility to WeakIncompatible (which should have been called CheckingIncompatible), then expect-actual matching model becomes consistent. We will also be able to get rid of unnecessary FirActualCallableDeclarationChecker. Because it won't be necessary. Return types will be checked by common logic of expect-actual "checker"