Open swift-ci opened 4 years ago
@swift-ci create
Reduce the issue a little bit further:
protocol MyProto {}
struct ABC {}
struct XYZ {}
@dynamicMemberLookup
class Something<Base> {
subscript<Prop>(dynamicMember keyPath: ReferenceWritableKeyPath<Base, Prop>) -> XYZ {
.init()
}
}
extension Something where Base: MyProto {
subscript<Prop>(dynamicMember keyPath: ReferenceWritableKeyPath<Base, Prop>) -> ABC {
.init()
}
}
class Example: MyProto {
var value: String = ""
}
func tester() {
let control = Something<Example>()
let res = control.#^COMPLETE^#
}
// CHECK: Decl[InstanceVar]/CurrNominal: value[#ABC#]; name=value
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | New Feature | |Assignee | None | |Priority | Medium | md5: ea74299f5a54ddc1c2ff715e14847409Issue Description:
Im not sure if this is a bug or something not expressible by Swift. Feel free to close this if it doesn't make sense.
I have code similar to the following:
This code causes some unexpected (or not) disambiguation. Sometimes it matches the ABC return type and sometimes the XYZ return type. This seems to be even worse when the extension is in a different module.
I would expect:
res recognized as ABC
auto-complete recognized as XYZ
Thank you🙂