Avatar
swiftbot BOT 8/2/2018 10:00 AM
Author icon
koher
protocol Animal { func foo() -> Self } class Cat: Animal { func foo() -> Cat { return Cat() } } class Siamese: Cat { } let siamese = Siamese() let cat = siamese.foo()
Version:
swift-4.1.1-RELEASE
Output:
Error:
/usercode/main.swift:6:10: error: method 'foo()' in non-final class 'Cat' must return `Self` to conform to protocol 'Animal' func foo() -> Cat { return Cat() } ^