Same-named argument and tuple labels?

I'm hesitant to file tuple-related bugs since I have no idea what the design goals for tuples are, and I'm a bit worried that compiler developers might be working without a common goal in this area, in which case bug(?) reports and fixes(?) might just add more cruft and confusion. Here's a simple example to show what I mean by this:

// This compiles successfully in Xcode 9.4, 10 beta and recent snapshots:
let c = (singleElementTupleLabel: 123).singleElementTupleLabel

But this can be either (1) a bug or (2) expected behavior, depending on whether single element labeled tuple types should (1) continue to be banned or (2) be re-enabled.

I'd prefer (2) since it would remove a weird special case, and there are signs that things are moving in that direction as of Xcode 10 beta. I know you saw my other thread about this specific case but I'm linking to it here for reference.

4 Likes