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@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to