swiftlang/swift
Vedi su GitHubBad diagnostic when inheriting from class in extension
Open
#64.903 aperta il 4 apr 2023
bugcompilerdiagnostics qualityextensiongood first issueinheritanceswift 6.0type checker
Metriche repository
- Star
- (69.989 star)
- Metriche merge PR
- (Merge medio 8g 17h) (510 PR mergiate in 30 g)
Descrizione
The following errors are misleading and could use a rewording as clear language rules, depending on the kinds of extended and inherited types.
protocol P {}
struct S {}
class C1 {}
class C2 {}
extension C2: S {} // error: inheritance from non-protocol type 'S'
extension C2: C1 {} // error: inheritance from non-protocol type 'C1'
extension C2: C1 & P {} // error: inheritance from class-constrained protocol composition type 'C1 & P'
Environment
- Swift version 5.9-dev (LLVM 6a04c4848990c70, Swift c1d5118c21d)
NB: How to improve on these is left as an exercise to whoever takes the issue.