FIR LC: additional checks on synthetic members of data class
This commit is contained in:
committed by
Ilya Kirillov
parent
5af24dc6ce
commit
56867d9c7e
+9
-7
@@ -159,14 +159,16 @@ internal class FirLightClassForSymbol(
|
|||||||
val functionsFromAny = mutableMapOf<Name, KtFunctionSymbol>()
|
val functionsFromAny = mutableMapOf<Name, KtFunctionSymbol>()
|
||||||
// NB: componentN and copy are added during RAW FIR, but synthetic members from `Any` are not.
|
// NB: componentN and copy are added during RAW FIR, but synthetic members from `Any` are not.
|
||||||
// Thus, using declared member scope is not sufficient to lookup "all" synthetic members.
|
// Thus, using declared member scope is not sufficient to lookup "all" synthetic members.
|
||||||
classOrObjectSymbol.getMemberScope().getCallableSymbols().forEach { symbol ->
|
classOrObjectSymbol.getMemberScope().getCallableSymbols().forEach { functionSymbol ->
|
||||||
if (symbol is KtFunctionSymbol) {
|
if (functionSymbol is KtFunctionSymbol) {
|
||||||
val name = symbol.name
|
val name = functionSymbol.name
|
||||||
if (DataClassResolver.isCopy(name) || DataClassResolver.isComponentLike(name)) {
|
if (functionSymbol.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED &&
|
||||||
componentAndCopyFunctions.add(symbol)
|
(DataClassResolver.isCopy(name) || DataClassResolver.isComponentLike(name))
|
||||||
|
) {
|
||||||
|
componentAndCopyFunctions.add(functionSymbol)
|
||||||
}
|
}
|
||||||
if (name.isFromAny) {
|
if (functionSymbol.dispatchType?.isAny == true && name.isFromAny) {
|
||||||
functionsFromAny[name] = symbol
|
functionsFromAny[name] = functionSymbol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user