Pattern matching Errors

Recall that FooError does not conform to FooError, so [FooError] does not match the constraint Array where Element : FooError. If FooError had Self or associated type requirements, the compiler would have reminded you of this fact.

This is an excellent example of a pitfall that is relevant to the discussion here and here.

2 Likes