Ok it's working as it should, due to two things working together:
1. When casting collections, Swift does not look just at the collection element type, but will at runtime look at all the elements of the collection. If all elements can be casted, the cast actually works. So A and B:A, an [A] array can be casted to [B] iff [A] contains only instances of B.
2. Sendable is a protocol that is only checked at runtime. The runtime does not know about it. So the casts work.
TGIF.
@arroz I might be misunderstanding, but did you mean compile time in the first sentence of 2)? Sendable is only checked at compile time. It's a marker protocol.
And because of this I'm not sure if I would say it's working as it should. This is very dangerous code as it's broken in a very subtle way: It will "cast" objects that are not Sendable. So they will be accepted in code paths that require Sendable. This will introduce concurrency bugs that are extremely hard to debug.