swiftlang/swift

Redundant error for missing type annotation in computed property

Ouverte

#87 322 ouverte le 18 févr. 2026

 (2 commentaires) (0 réaction) (1 personne assignée)Swift (10 719 forks)batch import
compilerdiagnostics qualitygood first issuelet & varswift 6.3type checker

Métriques du dépôt

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

Description

Description

No response

Reproduction

func foo() {
  var int {}
}
error: computed property must have an explicit type [computed_property_missing_type]
  91 | 
  92 | func foo() {
  93 |   var int {}
     |       `- error: computed property must have an explicit type [computed_property_missing_type]
  94 | }
  95 | 

error: type annotation missing in pattern [cannot_infer_type_for_pattern]
  91 | 
  92 | func foo() {
  93 |   var int {}
     |       `- error: type annotation missing in pattern [cannot_infer_type_for_pattern]
  94 | }
  95 | 

Expected behavior

The second error is superfluous.

Environment

Swift version 6.3-dev (fddce85428f14f8)

Additional information

No response

Guide contributeur