[FIR] Actualize expect nested classes in type arguments in expect actual

...checker.

^KT-31636
This commit is contained in:
Roman Efremov
2023-11-27 15:40:59 +01:00
committed by Space Team
parent cec644e9db
commit d343e40ac5
3 changed files with 17 additions and 4 deletions
@@ -365,10 +365,23 @@ class FirExpectActualMatchingContextImpl private constructor(
if (this is ConeClassLikeType && classId?.isNestedClass == true) {
val classSymbol = classId.toSymbol(actualSession)
if (classSymbol is FirRegularClassSymbol && classSymbol.isExpect) {
tryExpandExpectNestedClassActualizedViaTypealias(this, classSymbol)?.let { return it }
tryExpandExpectNestedClassActualizedViaTypealias(this, classSymbol)?.let {
return it.actualizeTypeArguments()
}
}
}
return fullyExpandedType(actualSession)
return fullyExpandedType(actualSession).actualizeTypeArguments()
}
private fun ConeKotlinType.actualizeTypeArguments(): ConeKotlinType {
if (this !is ConeClassLikeType) {
return this
}
return withArguments { arg ->
if (arg is ConeKotlinTypeProjection) {
arg.replaceType(arg.type.actualize()) as ConeTypeProjection
} else arg
}
}
/**
@@ -14,4 +14,4 @@ class FooImpl {
}
}
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> = FooImpl
actual typealias Foo = FooImpl
@@ -14,4 +14,4 @@ class FooImpl {
}
}
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> = FooImpl
actual typealias Foo = FooImpl