Consider the following:
protocol AnyPromise { func always() -> Self } class Promise: AnyPromise { open func always() -> Self { return self } } let x: AnyPromise = Promise() x.always().always()
The purpose of AnyPromise is to be able to use the promise in a type erased fashion and do things with mutliple promises of different types. The return type of Self should be magic and work between protocols and generic classes.
Works ok in a playground:
Fails to compile in Fire / Silver:
/Users/jon/Documents/consoleapplication4222/Program.swift(9,7): error E179: Method “always() -> Self” not implemented as required for interface “AnyPromise”
/Users/jon/Documents/consoleapplication4222/Program.swift(9,7): warning N12: Possible match: Promise!.always() -> Self
/Users/jon/Documents/consoleapplication4222/Program.swift(3,10): warning N4: Type “AnyPromise” was declared here
Returning Promise, and other things I tried, also fails.