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>()
|
||||
// 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.
|
||||
classOrObjectSymbol.getMemberScope().getCallableSymbols().forEach { symbol ->
|
||||
if (symbol is KtFunctionSymbol) {
|
||||
val name = symbol.name
|
||||
if (DataClassResolver.isCopy(name) || DataClassResolver.isComponentLike(name)) {
|
||||
componentAndCopyFunctions.add(symbol)
|
||||
classOrObjectSymbol.getMemberScope().getCallableSymbols().forEach { functionSymbol ->
|
||||
if (functionSymbol is KtFunctionSymbol) {
|
||||
val name = functionSymbol.name
|
||||
if (functionSymbol.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED &&
|
||||
(DataClassResolver.isCopy(name) || DataClassResolver.isComponentLike(name))
|
||||
) {
|
||||
componentAndCopyFunctions.add(functionSymbol)
|
||||
}
|
||||
if (name.isFromAny) {
|
||||
functionsFromAny[name] = symbol
|
||||
if (functionSymbol.dispatchType?.isAny == true && name.isFromAny) {
|
||||
functionsFromAny[name] = functionSymbol
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user