Skip to content

[6.2] Sema: Never record argument label mismatches for unlabeled trailing closures #82156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AnthonyLatsis
Copy link
Collaborator

  • Explanation:
    Fixes a crash on invalid. The previous logic was causing a label mismatch constraint fix to be recorded for an unlabeled trailing closure argument matching a variadic paramater after a late recovery argument claim in matchCallArgumentsImpl, because the recovery claiming skips arguments matching defaulted parameters, but not variadic ones. We may want to reconsider that last part, but currently it regresses the quality of some diagnostics, and this is a targeted fix.

    The previous behavior is fine because the diagnosis routine associate with the constraint fix (diagnoseArgumentLabelError) skips unlabeled trailing closures when tallying labeling issues — unless there are no other issues and the tally is zero, which we assert it is not.

    Does not miscompile with assertions disabled.

  • Scope: Unlabeled trailing closure argument matching diagnostics QoI.

  • Issues: rdar://152313388.

  • Original PRs: Sema: Never record argument label mismatches for unlabeled trailing closures #82020.

  • Risk: Low. Worst-case potential regression should be in diagnostic quality.

  • Testing: Passed source compatibility suite.

  • Reviewers: @xedin

…losures

Fixes a crash on invalid. The previous logic was causing a label
mismatch constraint fix to be recorded for an unlabeled trailing closure
argument matching a variadic paramater after a late recovery argument
claim in `matchCallArgumentsImpl`, because the recovery claiming skips
arguments matching defaulted parameters, but not variadic ones. We may
want to reconsider that last part, but currently it regresses the
quality of some diagnostics, and this is a targeted fix.

The previous behavior is fine because the diagnosis routine associate
with the constraint fix (`diagnoseArgumentLabelError`) skips unlabeled
trailing closures when tallying labeling issues — *unless* there are no
other issues and the tally is zero, which we assert it is not.

Fixes rdar://152313388.

(cherry picked from commit f2e1420)
@AnthonyLatsis AnthonyLatsis requested a review from a team as a code owner June 10, 2025 17:07
@AnthonyLatsis
Copy link
Collaborator Author

@swift-ci please test

@AnthonyLatsis AnthonyLatsis enabled auto-merge June 10, 2025 20:35
@AnthonyLatsis AnthonyLatsis merged commit 5b71a7d into swiftlang:release/6.2 Jun 11, 2025
5 checks passed
@AnthonyLatsis AnthonyLatsis deleted the camellia-sinensis-6.2 branch June 11, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants