Found by the swift-json lint lane (coordinator session 8830f961), 2026-08-10. At two sites in swift-foundations/swift-json, redundant_nil_coalescing flagged } ?? nil where the ?? nil FLATTENS a double optional (T??) returned by withContiguousStorageIfAvailable. Applying the correction produced declared closure result 'Self?' is incompatible with contextual type 'Self' — a compile break that the linter itself then reports as clean.
Fleet-wide hazard: any lane running swiftlint --fix on this rule can land a compile break, and lint gives no signal. The rule's predicate must exclude positions where the coalesced expression is itself optional (double-optional flattening). Fixture wanted: a T?? site that must NOT fire, plus the ordinary T? positive control. Consumer-side workaround used in swift-json: rewrite as .flatMap { $0 } (semantically exact, not a disable).
Found by the swift-json lint lane (coordinator session 8830f961), 2026-08-10. At two sites in swift-foundations/swift-json,
redundant_nil_coalescingflagged} ?? nilwhere the?? nilFLATTENS a double optional (T??) returned bywithContiguousStorageIfAvailable. Applying the correction produceddeclared closure result 'Self?' is incompatible with contextual type 'Self'— a compile break that the linter itself then reports as clean.Fleet-wide hazard: any lane running
swiftlint --fixon this rule can land a compile break, and lint gives no signal. The rule's predicate must exclude positions where the coalesced expression is itself optional (double-optional flattening). Fixture wanted: aT??site that must NOT fire, plus the ordinaryT?positive control. Consumer-side workaround used in swift-json: rewrite as.flatMap { $0 }(semantically exact, not a disable).