-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionArea → source tooling: code completionexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesgood first issueGood for newcomersGood for newcomersmetatypesFeature → types: MetatypesFeature → types: Metatypessource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source toolingswift 5.9typesFeature: typesFeature: typesunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
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 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 (c1d5118)
Footnotes
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.code completionArea → source tooling: code completionArea → source tooling: code completionexistentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesgood first issueGood for newcomersGood for newcomersmetatypesFeature → types: MetatypesFeature → types: Metatypessource toolingArea: IDE support, SourceKit, and other source toolingArea: IDE support, SourceKit, and other source toolingswift 5.9typesFeature: typesFeature: typesunexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output