swiftlang/swift
Bad diagnostic about memberwise `init` not being public
Offen
#78.362 geöffnet am 24.12.2024
access controlcompilerconformancesdiagnostics qualityfix-itsgood first issuememberwise initswift 6.2type checker
Repository-Metriken
- Stars
- (69.989 Sterne)
- PR-Merge-Metriken
- (Durchschn. Merge 8T 17h) (510 gemergte PRs in 30 T)
Beschreibung
Description
No response
Reproduction
public struct Number: RawRepresentable {
public let rawValue: Int
}
398 | public struct Number: RawRepresentable {
| `- error: initializer 'init(rawValue:)' must be declared public because it matches a requirement in public protocol 'RawRepresentable' [witness_not_accessible_proto]
399 | public let rawValue: Int
400 | }
Expected behavior
This diagnostic is not great:
- What initializer? (The implicit memberwise initializer).
- How do I or can I at all declare it public? (An implicit memberwise initializer cannot be public).
- What should I do to make this work? (Declare an explicit initializer + fix-it).
Environment
Swift version 6.2-dev (LLVM 1a588e5b044c46f, Swift 55189bae8e55169)
Additional information
No response