Open
Description
Description
As reported in Jump-to-definition to init
of a C struct does not work, sourcekitd will return an incorrect value of key.modulename
for a non-existent constructor of a C struct. This incorrect module name prevents the subsequent navigation to the designated generated interface.
Reproduction
import Darwin
func test() {
_ = timespec(tv_sec: 0, tv_nsec: 0)
}
The cursor info (truncated) of the initializer of timespec
returned by sourcekitd is as follows,
key.kind: source.lang.swift.ref.function.constructor,
key.name: "init(tv_sec:tv_nsec:)",
key.usr: "s:So8timespecV6tv_sec0B5_nsecABSi_Sitcfc",
key.typename: "(timespec.Type) -> (Int, Int) -> timespec",
key.modulename: "Darwin",
...
key.is_system: true,
...
key.decl_lang: source.lang.swift,
Expected behavior
The expected value of key.modulename
should be "Darwin.POSIX.sys.types._timespec"
Instead of "Darwin"
.
Environment
swiftlang-6.0.0.6.8 clang-1600.0.23.1
Additional information
No response