[swift-evolution] Specified Protocol Conformances in Subclasses
David Waite
david at alkaline-solutions.com
Fri Mar 10 20:01:43 CST 2017
This works because your properties are read-only, thus allowed to be covariant. If you add a setter, the compiler will complain.
-DW
> On Mar 10, 2017, at 5:33 AM, Anton Zhilin via swift-evolution <swift-evolution at swift.org> wrote:
>
> Looks like a compiler bug, since it works with classes:
>
> class Base {}
> class Derived : Base {}
>
> class A {
> var x: Base? { return Base() }
> }
>
> class B : A {
> override var x: Derived? { return Derived() }
> }
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170310/62f69ef6/attachment.html>
More information about the swift-evolution
mailing list