[Expect/Actual] Add ability to skip matching of constructors of expect enums
In terms of MPP there are no such thing as `expect constructor` for enums, but they are physically exist in FIR and IR, so we need a switch which skips matching for them FE 1.0 implementation did not touch to avoid any hidden changes
This commit is contained in:
committed by
Space Team
parent
ba41e8ec38
commit
8b9079d026
+4
-8
@@ -37,6 +37,9 @@ class FirExpectActualMatchingContext(
|
||||
override val shouldCheckReturnTypesOfCallables: Boolean
|
||||
get() = false
|
||||
|
||||
override val enumConstructorsAreAlwaysCompatible: Boolean
|
||||
get() = true
|
||||
|
||||
private fun CallableSymbolMarker.asSymbol(): FirCallableSymbol<*> = this as FirCallableSymbol<*>
|
||||
private fun FunctionSymbolMarker.asSymbol(): FirFunctionSymbol<*> = this as FirFunctionSymbol<*>
|
||||
private fun PropertySymbolMarker.asSymbol(): FirPropertySymbol = this as FirPropertySymbol
|
||||
@@ -260,14 +263,7 @@ class FirExpectActualMatchingContext(
|
||||
override fun CallableSymbolMarker.shouldSkipMatching(containingExpectClass: RegularClassSymbolMarker): Boolean {
|
||||
val symbol = asSymbol()
|
||||
val classSymbol = containingExpectClass.asSymbol()
|
||||
val isConstructor = symbol is FirConstructorSymbol
|
||||
if (isConstructor && classSymbol.classKind.isEnumClass) {
|
||||
/*
|
||||
* Expect enums in FIR have (expect) constructors, but actually there is no need to map them
|
||||
*/
|
||||
return true
|
||||
}
|
||||
if (!isConstructor && symbol.dispatchReceiverType?.classId != classSymbol.classId) {
|
||||
if (symbol !is FirConstructorSymbol && symbol.dispatchReceiverType?.classId != classSymbol.classId) {
|
||||
// Skip fake overrides
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user