[FIR] 1/2 match and check expect fake-overrides vs actuals

^KT-63550 Fixed
Review: https://jetbrains.team/p/kt/reviews/13094/timeline

Now it's required to create a new ScopeSession when searching for expect
members for actuals. If you keep reusing actualScopeSession then members
declared in platform may "slip into" the search results, resulting an
incorrect expect for actual (e.g. it happens in
supertypeIsExpectActual_covariantOverrideOfInjectedFromSuper_transitiveSubstitutionFakeOverride.fir.kt)

I suppose that it always has been a bug that we reused
actualScopeSession because we were mixing actualScopeSession and
expect FirSession (which is a bad idea), but we simply didn't have cases
where this bug could be observed. Now after we started matching
fake-overrides, we have such cases.

But creating a new ScopeSession every time is a suboptimal solution. We
need to design a scope caching KT-63773
This commit is contained in:
Nikita Bobko
2023-11-15 19:25:18 +01:00
committed by teamcity
parent 5aa0475aa7
commit a1ce8ac175
58 changed files with 182 additions and 69 deletions
@@ -8,6 +8,26 @@ Output:
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:3:1: error: right-hand side of actual type alias cannot be of type kotlin.Nothing
actual typealias E01 = Nothing
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:3:18: error: 'actual typealias E01 = Nothing' has no corresponding members for expected class members:
fun equals(other: Any?): Boolean
fun hashCode(): Int
fun toString(): String
actual typealias E01 = Nothing
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:4:1: error: right-hand side of actual type alias should be a class, not another type alias.
actual typealias E02 = MyNothing
^
compiler/testData/multiplatform/implTypeAlias/actualTypealiasToNothing/jvm.kt:4:18: error: 'actual typealias E02 = MyNothing' has no corresponding members for expected class members:
fun equals(other: Any?): Boolean
fun hashCode(): Int
fun toString(): String
actual typealias E02 = MyNothing
^