swiftlang/swift

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

Open

#65.843 geöffnet am 10. Mai 2023

Auf GitHub ansehen
 (32 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Swift (10.719 Forks)batch import
IDE supportbugcode completionexistentialsgood first issuemetatypessource toolingswift 5.9typesunexpected behavior

Repository-Metriken

Stars
 (69.989 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T 17h) (510 gemergte PRs in 30 T)

Beschreibung

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)

Contributor Guide