Diagnostic for use of plain protocol name in type position should suggest `some` or `any`

Đang mở
#68,284 19 bình luận 0 reaction 1 người được giao Xem trên GitHub

@yyoungbash đang làm issue này rồi.

Từ ngày 29/10/2025.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

bug compiler diagnostics quality existentials fix-its generics good first issue opaque types swift 5.9 type checker types

The following code is invalid:

protocol P {
  associatedtype A
}

func generic(value: P) {}

The compiler currently produces the error message Use of protocol 'P' as a type must be written 'any P' with a fix-it to insert the any keyword.

However, a different (and often better!) fix here is to use the some keyword. The error message should be re-worded to prompt the programmer to consider any or some, and there should be two notes, each with a fix-it to insert any or some, respectively.

Ngôn ngữ chính
Swift
Star
70.4k
Fork
10.8k
Merge trung bình
2 ngày 2 giờ
Pull request đã merge (30 ngày)
461

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của swiftlang/swift

Tất cả issue của swiftlang/swift

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.