@@ -1717,9 +1717,12 @@ extension SourceKitLSPServer {
17171717 }
17181718 } ( )
17191719 occurrences += occurrences. flatMap {
1720- let overrides = index. occurrences ( relatedToUSR: $0. symbol. usr, roles: . overrideOf)
1721- // Only contain overrides that are children of one of the receiver types or their subtypes.
1722- return overrides. filter { override in
1720+ let overriddenUsrs = index. occurrences ( relatedToUSR: $0. symbol. usr, roles: . overrideOf) . map ( \. symbol. usr)
1721+ let overriddenSymbolDefinitions = overriddenUsrs. compactMap {
1722+ index. primaryDefinitionOrDeclarationOccurrence ( ofUSR: $0)
1723+ }
1724+ // Only contain overrides that are children of one of the receiver types or their subtypes or extensions.
1725+ return overriddenSymbolDefinitions. filter { override in
17231726 override. relations. contains ( where: {
17241727 guard $0. roles. contains ( . childOf) else {
17251728 return false
@@ -2473,13 +2476,13 @@ fileprivate struct DocumentNotificationRequestQueue {
24732476 }
24742477}
24752478
2476- /// Returns the USRs of the subtypes of `usrs` as well as their subtypes, transitively.
2479+ /// Returns the USRs of the subtypes of `usrs` as well as their subtypes and extensions , transitively.
24772480fileprivate func transitiveSubtypeClosure( ofUsrs usrs: [ String ] , index: CheckedIndex ) -> [ String ] {
24782481 var result : [ String ] = [ ]
24792482 for usr in usrs {
24802483 result. append ( usr)
2481- let directSubtypes = index. occurrences ( ofUSR: usr, roles: . baseOf) . flatMap { occurrence in
2482- occurrence. relations. filter { $0. roles. contains ( . baseOf) } . map ( \. symbol. usr)
2484+ let directSubtypes = index. occurrences ( ofUSR: usr, roles: [ . baseOf, . extendedBy ] ) . flatMap { occurrence in
2485+ occurrence. relations. filter { $0. roles. contains ( . baseOf) || $0 . roles . contains ( . extendedBy ) } . map ( \. symbol. usr)
24832486 }
24842487 let transitiveSubtypes = transitiveSubtypeClosure ( ofUsrs: directSubtypes, index: index)
24852488 result += transitiveSubtypes
0 commit comments