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()
}
}
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | CodeCompletion | |Labels | Bug, FoundByStressTester | |Assignee | None | |Priority | Medium | md5: 5ec040e6c738b2786564fada37f5dbb8Issue Description:
In the following test case, we are only suggesting
dynamicMember:
from thesubscript
insideBinding2
and notindex
from the global lookup, which is also a valid option and calls through to the subscript onArray