Support trailing closure syntax for single-argument Array and Dictionary initializers

I always get error: closure expression is unused in these sorts of non-result-builder examples, so I don’t think would be a source break, unless we can find an example that doesn’t produce the closure expression is unused error. The result builder case definitely is a source break though.

It seems reasonable for the long-term goal to be to not include this sort of heuristic, since it doesn’t exist for other trailing closure use cases.

If we are fine with the result builder source break (which we have no evidence of actually happening in practice), then we don’t need this heuristic. I recall we did ship minor result builder source breaks in a non-major language version somewhat recently ( Improved Result Builder Implementation in Swift 5.8 , well-justified given the benefits of that change).

The more conservative approach would be to use the same-line heuristic in the Swift 6 language mode, and drop it in the next language mode.

The only other path I can think of would be to not enable trailing closures here at all until the next language mode.