-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
| Previous ID | SR-12096 |
| Radar | rdar://problem/58997223 |
| Original Reporter | @kastiglione |
| Type | Bug |
Attachment: Download
Additional Detail from JIRA
| Votes | 0 |
| Component/s | |
| Labels | Bug |
| Assignee | None |
| Priority | Medium |
md5: 1ee7c9ff01d3a11c55b26c435d413b5a
relates to:
- [SR-12047] Types referenced with
is Foonot in index #54483 - [SR-12102] Discrepancy in indexstore for function parameter references #54538
Issue Description:
In a specific case, the index is missing references to initializers added in an enum extension. In this case, Result.
This example is two parts. First, an extension on Result that adds initializers:
extension Result {
public init(value: Success) {
self = .success(value)
}
public init(error: Failure) {
self = .failure(error)
}
}The second part is calling these initializers with explicit types:
let value = Result<Int, SomeError>(value: 5)
let error = Result<Int, SomeError>(error: .mistake)In this case, the index does not contain a reference to the initializers. This can be seen in Xcode, where searching for references to those initializers produce only the initializers themselves.
This problem only happens when the generic types are explicit. If they're inferred, then the index does correctly include proper references. Compare:
let value: Result<Int, SomeError> = Result(value: 5)
let error: Result<Int, SomeError> = Result(error: .mistake)In this case, the index works as expected.
In the problem case, the indexstore record files of the callers does not contain references to the initializer's symbol (USR).
Attached is a sample project, and a couple screenshots showing Xcode can't find references even though they exist in the test target.