swiftlang/swift
Ver no GitHubCode completion: Stop suggesting old-style protocol metatype syntax in Swift 6 mode
Open
#65.699 aberto em 5 de mai. de 2023
IDE supportbugcode completionexistentialsgood first issuemetatypessource toolingswift 5.9typesunexpected behavior
Métricas do repositório
- Stars
- (69.989 stars)
- Métricas de merge de PR
- (Mesclagem média 8d 17h) (510 fundiu PRs em 30d)
Description
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)