Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14544] Missing code completion for unresolved dot completion in closure if original call with trailing closure already exists #56896

Closed
ahoppen opened this issue Apr 28, 2021 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Apr 28, 2021

Previous ID SR-14544
Radar rdar://problem/77259087
Original Reporter @ahoppen
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Bug, FoundByStressTester
Assignee @ahoppen
Priority Medium

md5: e8753880c22a8299b75a584ffdf223c1

Issue Description:

In the following new test case COMPLETE_WITHOUT_SPACE is returning an empty response.

// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_WITHOUT_SPACE | %FileCheck %s -check-prefix=CHECK
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_WITH_SPACE | %FileCheck %s -check-prefix=CHECK
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_WITH_SPACE_AND_PARENS | %FileCheck %s -check-prefix=CHECK
// RUN: %target-swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE_WITHOUT_SPACE_AND_PARENS | %FileCheck %s -check-prefix=CHECK

public struct ItemWrapper {
  let content: Int
}

struct MyArray {
  func map(transform: (ItemWrapper) -> Int) {}
}

func sink(receiveValue: (MyArray) -> Void) {
  fatalError()
}

func foo() {
  sink { items in
    let a = items.#^COMPLETE_WITHOUT_SPACE^#map{ $0.content }
    let b = items.#^COMPLETE_WITH_SPACE^# map{ $0.content }
    let b = items.#^COMPLETE_WITH_SPACE_AND_PARENS^# map({ $0.content })
    let b = items.#^COMPLETE_WITHOUT_SPACE_AND_PARENS^# map({ $0.content })
  }
}

// CHECK: Begin completions, 2 items
// CHECK: Keyword[self]/CurrNominal:          self[#MyArray#]; name=self
// CHECK: Decl[InstanceMethod]/CurrNominal/TypeRelation[Invalid]: map({#transform: (ItemWrapper) -> Int##(ItemWrapper) -> Int#})[#Void#];
// CHECK: End completions

Apparently, this is also not just limited to a trailing closure on the function that is being completed but results also fail to show up if a chained call has a trailing closure.

@ahoppen
Copy link
Contributor Author

ahoppen commented Apr 28, 2021

@swift-ci create

@ahoppen
Copy link
Contributor Author

ahoppen commented Jun 25, 2021

Fixed in #38001

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the source tooling Area: IDE support, SourceKit, and other source tooling label Feb 6, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. code completion Area → source tooling: code completion found by stress tester Flag: An issue found by the SourceKit stress tester source tooling Area: IDE support, SourceKit, and other source tooling
Projects
None yet
Development

No branches or pull requests

2 participants