[FIR, IR] 1/2 Align FirExpectActualMatchingContextImpl.areCompatibleExpectActualTypes with ExpectActualUtilsKt.areCompatibleExpectActualTypes
Those two functions are copy-paste of each other. They diverged since the time they were copy-pasted. This commit makes FirExpectActualMatchingContextImpl.areCompatibleExpectActualTypes up-to-date. I didn't update ExpectActualUtilsKt.areCompatibleExpectActualTypes because I will drop it in the next commit. Change in `dynamicTypesEqualToAnything` doesn't change any logic (yet. This change in logic will take effect in the next commit), because: 1. `dynamicTypesEqualToAnything` is only changed in AbstractExpectActualChecker.getCallablesCheckingIncompatibility. But AbstractExpectActualChecker.getCallablesCheckingIncompatibility doesn't check return types on frontend (it only check return types on backend). 2. `dynamicTypesEqualToAnything` is ignored on IR backend I have no idea what is the difference between `createTypeCheckerState()` and `actualSession.typeContext`, but it aligns these copy-pasted versions and makes the tests behave like in K1 (at least 'typeUsageWithUnresolvedReference' and 'kt57320' are affected) This commit is mainly a preparation for the next commit. Review: https://jetbrains.team/p/kt/reviews/12750/timeline
This commit is contained in:
+2
-1
@@ -372,7 +372,8 @@ object AbstractExpectActualChecker {
|
||||
if (!areCompatibleExpectActualTypes(
|
||||
substitutor.safeSubstitute(expectDeclaration.returnType),
|
||||
actualDeclaration.returnType,
|
||||
parameterOfAnnotationComparisonMode = insideAnnotationClass
|
||||
parameterOfAnnotationComparisonMode = insideAnnotationClass,
|
||||
dynamicTypesEqualToAnything = false
|
||||
)
|
||||
) {
|
||||
return ExpectActualCheckingCompatibility.ReturnType
|
||||
|
||||
+1
@@ -147,6 +147,7 @@ interface ExpectActualMatchingContext<T : DeclarationSymbolMarker> : TypeSystemC
|
||||
expectType: KotlinTypeMarker?,
|
||||
actualType: KotlinTypeMarker?,
|
||||
parameterOfAnnotationComparisonMode: Boolean = false,
|
||||
dynamicTypesEqualToAnything: Boolean = true
|
||||
): Boolean
|
||||
|
||||
fun actualTypeIsSubtypeOfExpectType(
|
||||
|
||||
Reference in New Issue
Block a user