`[.]Type` completion for `(any P).` shows it will produce an existential metatype

Open
#65,843 32 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
swift
Domain
tooling

Research direction

Start with the supplied swift-ide-test batch code-completion case and compare its current output with the FileCheck expectation for (any P).Type. Done means the completion output identifies the result as the singleton metatype (any P).Type, rather than the existential metatype any P.Type.

Written by the indexing model from the issue text.

Description

bug code completion existentials good first issue IDE support metatypes swift 5.9 types unexpected behavior

Test case:

// RUN: %empty-directory(%t)
// RUN: %target-swift-ide-test -batch-code-completion -source-filename %s -filecheck %raw-FileCheck -completion-output-dir %t
protocol P {}

(any P).#^COMPLETE?check=META^# 
// META: Keyword/CurrNominal:  Type[#(any P).Type#]; name=Type

This test will fail, because the current completion is Type[#any P.Type#]; name=Type. Notice how it thinks the completion will produce an existential metatype any P.Type, whereas the actual result is the singleton metatype (any P).Type.

Note
any syntax was proposed in SE-0335.

Environment

  • Swift 5.9-dev (c1d5118c21da49a9c2194734cbf9b6970bc63056)
Dominant language
Swift
Stars
70.4k
Forks
10.8k
Avg merge
2d 2h
Merged PRs (30d)
461

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from swiftlang/swift

All issues in swiftlang/swift

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.