Skip to content

[SR-12102] Discrepancy in indexstore for function parameter references #54538

@kastiglione

Description

@kastiglione
Previous ID SR-12102
Radar rdar://problem/58999116
Original Reporter @kastiglione
Type Bug
Status Resolved
Resolution Invalid
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 73c21047efd85ce0ba0a16efe385a836

relates to:

  • SR-12096 Index missing references to initializers in Result extensions

Issue Description:

With Swift 5.1, I've noticed that the parameter references in the indexstore vary by how a parameter is labeled.

Consider these three mostly equivalent functions:

func named(n: Int) {
    print(n)
}

func labeled(number n: Int) {
    print(n)
}

func unlabeled(_ n: Int) {
    print(n)
}

In the first case – named(n:), where the parameter n has the default self-named label, the indexstore does (correctly?) contain references to the use of parameter n. Specifically, the print(n) statement has the following references:

  /*
        | function.accessorGetter=getter:n
        | parameter=n */
  print(n)

There's a symbol occurrence named getter:n and it has kind = INDEXSTORE_SYMBOL_KIND_FUNCTION and subkind = INDEXSTORE_SYMBOL_SUBKIND_ACCESSORGETTER.

There's also a symbol occurrence named n and it has kind = INDEXSTORE_SYMBOL_KIND_PARAMETER.

However, in the other two cases – labeled(number:) and unlabeled(_:), there is no symbol occurrences at all for the parameter n. It seems by giving the parameter a custom label, or giving it no label, the index references aren't being generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions