Skip to content

Incorrect key.modulename of constructor in Cursor Info #75517

@AppAppWorks

Description

@AppAppWorks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    SourceKitArea → source tooling: SourceKitbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.cursor infoArea → source tooling: cursor infosource toolingArea: IDE support, SourceKit, and other source toolingswift 6.0unexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions