[SR-7093] Index does not include reference to constructor of class/struct with generic types
swift-ci opened this issue · 5 comments
Previous ID | SR-7093 |
Radar | rdar://problem/70955529 |
Original Reporter | Leitch (JIRA User) |
Type | Bug |
Environment
Using SourceKitten to perform the SourceKit request.
Xcode 9.2
Build version 9C40b
macOS 10.13.3
Additional Detail from JIRA
Votes | 2 |
Component/s | Source Tooling |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: f31c557a78a7016c21e6bf633e9bada7
Issue Description:
Given the following code:
class ClassA<T> {
init(someVar: Int = 0) {}
}
class ClassB {
private let classA: ClassA<String>
init() {
classA = ClassA<String>()
}
}
A source.request.indexsource
response does not include a source.lang.swift.ref.function.constructor
reference for ClassA<String>()
to the declaration init(someVar:)
. The constructor has the USR s:4test6ClassACACyxGSi7someVar_tcfc
and it is not referenced anywhere in the index.
This issue appears to only affect classes with generic types. If I remove the generic type from ClassA
, the ClassB
constructor declaration will contain a reference to init(someVar:)
.
Full index response is here: https://gist.github.com/ileitch/2b6b08ab247d712da752c5c24b5fca85
Comment by Ian Leitch (JIRA)
@benlangmuir This is also an issue with the index store in Swift 5.3.1.
Also reproduces with indexing while building
$ swift-ide-test --print-indexed-symbols --source-filename /tmp/t.swift
...
9:18 | class/Swift | ClassA | s:14swift_ide_test6ClassAC | Ref,RelCont | rel: 1
RelCont | constructor/Swift | init() | s:14swift_ide_test6ClassBCACycfc
9:25 | struct/Swift | String | s:SS | Ref,RelCont | rel: 1
RelCont | constructor/Swift | init() | s:14swift_ide_test6ClassBCACycfc
No reference to the initializer.
@swift-ci create
Comment by Ian Leitch (JIRA)
This also affects generic structs.