Avatar
Avatar
Iceman
@swift-5.7.3 protocol P {} struct S: P {} extension CustomStringConvertible { func f() -> some P { S() } } var foo: some P { "".f() } var bar: some P { ("" as any CustomStringConvertible).f() }
exit status: 1 with stderr:<stdin>:15:39: error: type 'any P' cannot conform to 'P' ("" as any CustomStringConvertible).f() ^ <stdin>:15:39: note: only concrete types such as structs, enums and classes can conform to protocols ("" as any CustomStringConvertible).f() ^ <stdin>:14:10: note: required by opaque return type of var 'bar' var bar: some P { ^~~~~~