Open
Description
Currently, the compiler allows to build this code:
protocol TestDelegate1 {
var name: NSObject { get }
}
protocol TestDelegate2: TestDelegate1 {
var name: NSString { get }
}
But it does not allow adding overrides to TestDelegate2 and it doesn't allow to has redeclaration properties in class/struct... I don't know if it is a limitation or a bug
The only solution for now is to add an extension to TestDelegate2 that implements var name: NSObject
in it like:
extension TestDelegate2 {
var name: NSObject {
fatalError("not support")
}
}
struct TestClass: TestDelegate2 {
var name: NSString = ""
}
But the compiler does not warn about this any at all, it just gives some unhelpful errors
Metadata
Metadata
Assignees
Labels
A deviation from expected or documented behavior. Also: expected but undesirable behavior.The Swift compiler itselfFeature → protocol: protocol conformancesBug: Diagnostics Quality of ImplementationBug: Missing warningFeature → type declarations: Protocol declarationsArea → compiler: Semantic analysis