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-14738] Code completion not performing global completion in subscript on dynamicMemberLookup type #57088

Open
ahoppen opened this issue Jun 8, 2021 · 2 comments
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 Jun 8, 2021

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

md5: 5ec040e6c738b2786564fada37f5dbb8

Issue Description:

In the following test case, we are only suggesting dynamicMember: from the subscript inside Binding2 and not index from the global lookup, which is also a valid option and calls through to the subscript on Array

// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=COMPLETE

var fields: Binding2<[String]> = Binding2()

func morningField() -> Binding2<String> {
  let index = 0
  return fields[#^COMPLETE^#index]
}

@dynamicMemberLookup public struct Binding2<Value> {
  public subscript<Subject>(dynamicMember keyPath: WritableKeyPath<Value, Subject>) -> Binding2<Subject> {
    fatalError()
  }
}
@typesanitizer
Copy link

@swift-ci create

@ahoppen
Copy link
Contributor Author

ahoppen commented Jan 5, 2022

The issue does not occur if call pattern heuristics are enabled, i.e. if --code-complete-call-pattern-heuristics is passed to swift-ide-test.

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

3 participants