Right now, Swift's type system allows tuple conversions that both add and remove labels. These kinds of bidirectional subtyping rules are difficult for the type checker because it isn't clear which one is "better" or more specific. If we made the rule directional, to say that maybe (T, U)
is a supertype of (label: T, label: U)
and not the other way around, then the type checker would be able to clearly favor labeled tuples as more specific than unlabeled ones.
14 Likes