Skip to content

[SR-7093] Index does not include reference to constructor of class/struct with generic types #49641

@swift-ci

Description

@swift-ci
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

/cc @nkcsgexi @benlangmuir

Metadata

Metadata

Assignees

No one assigned

    Labels

    call expressionsFeature → expressions: Call expressionsdeclarationsFeature: declarationsexpressionsFeature: expressionsgenericsFeature: generic declarations and typesindexingArea → source tooling: AST indexinginitFeature → declarations: Initializerssource toolingArea: IDE support, SourceKit, and other source toolingswift 4.0type declarationsFeature → declarations: Type declarationsunexpected behaviorBug: Unexpected behavior or incorrect output

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions