swiftlang/swift
Vedi su GitHubCode completion: Stop suggesting old-style protocol metatype syntax in Swift 6 mode
Open
#65.699 aperta il 5 mag 2023
bugcode completionexistentialsgood first issuemetatypessource toolingswift 5.9typesunexpected behavior
Metriche repository
- Star
- (69.989 star)
- Metriche merge PR
- (Merge medio 8g 17h) (510 PR mergiate in 30 g)
Descrizione
In Swift 6 mode, [.]Protocol1 is no longer a valid suggestion. Per SE-0335, we should suggest two distinct [.]Type1 completions for a plain protocol/composition — one aiming at any P.Type and another aiming at (any P).Type — that also insert a missing any prefix, and parenthesize the acted-upon existential in the second case.
Test case (should not succeed):
// RUN: %empty-directory(%t)
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t -swift-version 6
protocol P {}
let _: P#^COMPLETE1?check=META^#
let _: any P#^COMPLETE2?check=META^#
let _: (any P)#^COMPLETE3?check=META^#
// META: Keyword/None: .Protocol[#(any P).Type#]; name=Protocol
Environment
- Swift 5.9-dev (c1d5118c21d)