Skip to content

[SR-16055] Code completion disfavors overload based on optional conversion after the code completion token #58316

@ahoppen

Description

@ahoppen
Previous ID SR-16055
Radar rdar://90769544
Original Reporter @ahoppen
Type Bug
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee None
Priority Medium

md5: 8ab05b24b2d9e29856ad3b1df3d7b207

Issue Description:

The following new test case only suggests the primaryButton overload and not the dismissButton overload because dismissButton requires an optional conversion and thus has a higher score. Both should be suggested

struct Text {
  init(_ x: Int) {}
}

struct Alert {
  init(message: Text, dismissButton: Text?) {}
  init(message: Text, primaryButton: Text) {}
}

func foo() {
  _ = Alert(message: Text(1), #^COMPLETE^#primaryButton: Text(2))
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionfound by stress testerFlag: An issue found by the SourceKit stress testersource toolingArea: IDE support, SourceKit, and other source tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions