-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Do not offer completion Wrapped members for optional key path root type #33601
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
[CodeCompletion] Do not offer completion Wrapped members for optional key path root type #33601
Conversation
@swift-ci Please test |
cc @varungandhi-apple :) |
Build failed |
@swift-ci Please test MacOS platform |
I think what we need to do is not removing struct MyStruct {
var value: Int { 1 }
}
func foo<T>(x: KeyPath<MyStruct?, T>) {}
let _ = foo(x: \.?.value)
let _ = foo(x: \MyStruct?.?.value) |
TIL |
TIL as well. It looks like the grammar mentions it: https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#grammar_key-path-components. |
I also didn't known this Thanks @rintaro, I'll make the changes :) |
07fb02b
to
54c58f1
Compare
Changes applied to not erase the |
54c58f1
to
56f212f
Compare
…a root unwrapped members
56f212f
to
ecc5b90
Compare
@swift-ci Please smoke test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
As described on the SR code completion is offering wrapped member for optional root key path type, which leads to invalid completions in some situations because using key path optional root to access wrapped members is invalid.
Resolves SR-13426.