swiftlang/swift

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

Open

#65 843 ouverte le 10 mai 2023

Voir sur GitHub
 (32 commentaires) (0 réactions) (0 assignés)Swift (10 719 forks)batch import
bugcode completionexistentialsgood first issuemetatypessource toolingswift 5.9typesunexpected behavior

Métriques du dépôt

Stars
 (69 989 stars)
Métriques de merge PR
 (Merge moyen 8j 17h) (510 PRs mergées en 30 j)

Description

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)

Guide contributeur