-   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.declarationsFeature: declarationsFeature: declarationsextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsindexingArea → source tooling: AST indexingArea → source tooling: AST indexingsource 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
With this code:
typealias Foo = Int extension Foo {}You get these index references:
/* typealias=Foo=s:3foo3Fooa=definition | struct=Int=s:Si=reference v v */ typealias Foo = Int /* typealias=Foo=s:3foo3Fooa=reference v */ extension Foo {}But when you add a function to the body of the extension you get more info on the extension definition itself:
/* typealias=Foo=s:3foo3Fooa=definition | struct=Int=s:Si=reference v v */ typealias Foo = Int /* typealias=Foo=s:3foo3Fooa=reference struct=Int=s:Si=reference, implicit, extendedBy extension.swiftExtensionOfStruct=Int=s:e:s:Si3fooE3baryyF=definition v */ extension Foo { /* instanceMethod=bar()=s:Si3fooE3baryyF=definition, childOf v */ func bar() {} }I'm not actually sure if this matters because you do also get this correct info in the case that you're adding a protocol conformance as well:
/* typealias=Foo=s:3foo3Fooa=definition | struct=Int=s:Si=reference v v */ typealias Foo = Int /* protocol=P=s:3foo1PP=definition v */ protocol P {} /* typealias=Foo=s:3foo3Fooa=reference struct=Int=s:Si=reference, implicit, extendedBy extension.swiftExtensionOfStruct=Int=s:e:s:Sis:3foo1PP=definition | protocol=P=s:3foo1PP=reference, baseOf v v */ extension Foo: P {}So maybe this only hits in the case the extension is a no-op anyways, but I was surprised to see a difference here so I wanted to document it
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.declarationsFeature: declarationsFeature: declarationsextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsindexingArea → source tooling: AST indexingArea → source tooling: AST indexingsource 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