swiftlang/swift

Redundant error for missing type annotation in computed property

Open

#87,322 创建于 2026年2月18日

在 GitHub 查看
 (2 评论) (0 反应) (1 负责人)Swift (69,989 star) (10,719 fork)batch import
compilerdiagnostics qualitygood first issuelet & varswift 6.3type checker

描述

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

贡献者指南

Redundant error for missing type annotation in computed property · swiftlang/swift#87322 | Good First Issue