Avatar
Avatar
Iceman
@swift-5.6.3 @swift-5.7.3 protocol P {} struct S: P {} extension Error { func f() -> some P { S() } } extension String: Error {} var foo: some P { "".f() } var bar: some P { ("" as any Error).f() } (edited)
exit status: 1 with stderr:<stdin>:17:7: error: member 'f' cannot be used on value of protocol type 'Error'; use a generic constraint instead ("" as any Error).f() ~~~~^~~~~~~~~~~~~ ~