FirElementSerializer cleanup
Review: https://jetbrains.team/p/kt/reviews/13495/timeline
This commit is contained in:
+7
-15
@@ -411,27 +411,19 @@ class FirElementSerializer private constructor(
|
|||||||
): List<T> {
|
): List<T> {
|
||||||
val foundInScope = buildList {
|
val foundInScope = buildList {
|
||||||
val memberScope = unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null)
|
val memberScope = unsubstitutedScope(session, scopeSession, withForcedTypeCalculator = false, memberRequiredPhase = null)
|
||||||
processScope(memberScope) l@{
|
processScope(memberScope) {
|
||||||
val declaration = it.fir as T
|
val declaration = it.fir as T
|
||||||
val dispatchReceiverLookupTag = declaration.dispatchReceiverClassLookupTagOrNull()
|
val dispatchReceiverLookupTag = declaration.dispatchReceiverClassLookupTagOrNull()
|
||||||
// Special case for data/value class equals/hashCode/toString, see KT-57510
|
// Special case for data/value class equals/hashCode/toString, see KT-57510
|
||||||
val isOverrideOfAnyFunctionInDataOrValueClass = this@collectDeclarations is FirRegularClass &&
|
val isFakeOverrideOfAnyFunctionInDataOrValueClass = this@collectDeclarations is FirRegularClass &&
|
||||||
(this@collectDeclarations.isData || this@collectDeclarations.isInline) &&
|
(this@collectDeclarations.isData || this@collectDeclarations.isInline) &&
|
||||||
dispatchReceiverLookupTag?.classId == StandardClassIds.Any && !declaration.isFinal
|
dispatchReceiverLookupTag?.classId == StandardClassIds.Any && !declaration.isFinal
|
||||||
if (declaration.isSubstitutionOrIntersectionOverride) {
|
if (isFakeOverrideOfAnyFunctionInDataOrValueClass ||
|
||||||
if (!isOverrideOfAnyFunctionInDataOrValueClass) {
|
!declaration.isSubstitutionOrIntersectionOverride &&
|
||||||
return@l
|
(declaration.isStatic || declaration is FirConstructor || dispatchReceiverLookupTag == this@collectDeclarations.symbol.toLookupTag())
|
||||||
}
|
) {
|
||||||
} else if (!(declaration.isStatic || declaration is FirConstructor)) {
|
add(declaration)
|
||||||
// non-intersection or substitution fake override
|
|
||||||
if (dispatchReceiverLookupTag != this@collectDeclarations.symbol.toLookupTag()) {
|
|
||||||
if (!isOverrideOfAnyFunctionInDataOrValueClass) {
|
|
||||||
return@l
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add(declaration)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (declaration in declarations) {
|
for (declaration in declarations) {
|
||||||
|
|||||||
Reference in New Issue
Block a user