-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.classFeature → type declarations: Class declarationsFeature → type declarations: Class declarationsconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesdeclarationsFeature: declarationsFeature: declarationsindexingArea → source tooling: AST indexingArea → source tooling: AST indexinginheritanceFeature → type declarations → class: Subclassing and inheritance of class membersFeature → type declarations → class: Subclassing and inheritance of class membersoptional protocol requirementsFeature → protocol: optional protocol requirementsFeature → protocol: optional protocol requirementsprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationssource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source toolingswift 5.9unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
| Previous ID | SR-13930 |
| Radar | rdar://problem/71941002 |
| Original Reporter | Leitch (JIRA User) |
| Type | Bug |
Environment
Swift 5.3.1
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Source Tooling |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: b4e60253efa0e8c7ffa0ba78d8eff02f
Issue Description:
Given the following code:
import Foundation
open class Baseclass: NSObject, FileManagerDelegate {
public func fileManager(_ fileManager: FileManager, shouldRemoveItemAt URL: URL) -> Bool {
false
}
}
public class Subclass: Baseclass {
func fileManager(_ fileManager: FileManager, shouldRemoveItemAtPath path: String) -> Bool {
false
}
}The index store does not relate the method implemented in the subclass to the protocol declaration, although it does so for the method implemented in the baseclass. From the perspective of detecting unused code, it's not possible to identify that fileManager(_:shouldRemoveItemAtPath:) is an implementation of the protocol method.
Method in subclass:
10:10 | instance-method/Swift | fileManager(_:shouldRemoveItemAtPath:) | c:@M@swift_ide_test@objc(cs)Subclass(im)fileManager:shouldRemoveItemAtPath: | Def,Dyn,RelChild | rel: 1
RelChild | class/Swift | Subclass | c:@M@swift_ide_test@objc(cs)SubclassMethod in baseclass, note the extra `RelOver`:
9:14 | instance-method/Swift | fileManager(_:shouldRemoveItemAt:) | c:@M@swift_ide_test@objc(cs)Baseclass(im)fileManager:shouldRemoveItemAtURL: | Impl,RelOver,RelCont | rel: 2
RelOver | instance-method/Swift | fileManager(_:shouldRemoveItemAt:) | c:objc(pl)NSFileManagerDelegate(im)fileManager:shouldRemoveItemAtURL:
RelCont | class/Swift | Subclass | c:@M@swift_ide_test@objc(cs)Subclasstaise-hikawa
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.classFeature → type declarations: Class declarationsFeature → type declarations: Class declarationsconformancesFeature → protocol: protocol conformancesFeature → protocol: protocol conformancesdeclarationsFeature: declarationsFeature: declarationsindexingArea → source tooling: AST indexingArea → source tooling: AST indexinginheritanceFeature → type declarations → class: Subclassing and inheritance of class membersFeature → type declarations → class: Subclassing and inheritance of class membersoptional protocol requirementsFeature → protocol: optional protocol requirementsFeature → protocol: optional protocol requirementsprotocolFeature → type declarations: Protocol declarationsFeature → type declarations: Protocol declarationssource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source toolingswift 5.9unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output