Avatar
Avatar
omochimetaru
@swift-5.6.3 @swift-5.7.3 protocol P {} protocol Q {} struct S: P {} extension Q { func p() -> some P { return S() } } func foo(q: Q) -> some P { return q.p() }
exit status: 1 with stderr:<stdin>:8:12: error: type 'any P' cannot conform to 'P' return q.p() ^ <stdin>:8:12: note: only concrete types such as structs, enums and classes can conform to protocols return q.p() ^ <stdin>:7:19: note: required by opaque return type of global function 'foo(q:)' func foo(q: Q) -> some P { ^~~~~~