Error is a protocol and one is able to do this...
let x: Result<Void, Error> = .success(())
ShadowError conforms to Error and is also a protocol yet one is not able to do this...
protocol ShadowError: Error {}
let x: Result<Void, ShadowError> = .success(()) // FAILS Type 'any ShadowError' cannot conform to Error
Because the compiler complains with this error
Type 'any ShadowError' cannot conform to Error
Is there anyway for the results Failure type be ShadowError (or other protocol)?
This is not possible as a protocol. You can make ShadowError an enum or a struct (even a struct that wraps another Error), but it a can't be a protocol. Protocol existentials ("any" instances of the protocol) do not conform to protocols, so
any ShadowErroris not an Error. There is one magical exception to this:any Errordoes conform toError. But you can't reproduce that. It's onlyError.For the docs on this, see SE-0235 Add Result to the Standard Library: