-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Code completion: Stop suggesting old-style protocol metatype syntax in Swift 6 mode #65699
Comments
@AnthonyLatsis |
@Rajveer100 After updating the description, I am no longer positive this can be qualified as a beginner-friendly issue, but here is some tips:
|
Yes, I agree that this could be a good first issue. |
Hi Sir, protocol P {}
P#^COMPLETE?check=META^#
// META: Keyword/CurrNominal: .Protocol[#(any P).Type#]; name=Protocol changes to protocol P {}
P.#^COMPLETE?check=META^#
// META: Keyword/CurrNominal: .Type[#any P.Type#]; name=Type
// META: Keyword/CurrNominal: .Type[#(any P).Type#]; name=Type |
Note that a solution should also handle the |
// META: Keyword/CurrNominal: .Type[#any P.Type#]; name=Type isn't this correct Sir? |
Your completion suggestions are fine for
|
any P.#^ANY_COMPLETE?check=META^# (any P).#^PAREN_COMPLETE?check=META^# When we trigger code completion at any P.#^ANY_COMPLETE?check=META^#, the completion suggestion is .Type[#any P.Type#], which represents the existential metatype for any P. There is no completion suggestion provided for (any P)#^COMPLETE?check=META^# because any P.Protocol is not a sensible type and (any P).Protocol is a mixture of the old and new syntaxe I hope it works. |
In Swift 6 mode,
[.]Protocol
1 is no longer a valid suggestion. Per SE-0335, we should suggest two distinct[.]Type
1 completions for a plain protocol/composition — one aiming atany P.Type
and another aiming at(any P).Type
— that also insert a missingany
prefix, and parenthesize the acted-upon existential in the second case.Test case (should not succeed):
Environment
Footnotes
[x]
meansx
is optional ↩ ↩2The text was updated successfully, but these errors were encountered: