Skip to content

[6.2] SwiftFixIt: Skip duplicate insertion fix-its #8915

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
merged 2 commits into from
Jul 10, 2025
Merged

Conversation

AnthonyLatsis
Copy link
Contributor

  • Explanation:
    There are various scenarios — most notably involving protocol compositions — where multiple different sites are diagnosed with the same insertion fix-it. For example, compiling the following code with -enable-upcoming-feature InferIsolatedConformances:migrate generates 2 warnings with equal fix-its for prepending nonisolated to the composition:

    protocol P {}
    protocol Q {}
    
    @MainActor struct S: P & Q {}

    Applying both fix-its will produce invalid code: @MainActor struct S: nonisolated nonisolated P & Q {}.

  • Scope: swift package migrate.

  • Issues: —

  • Original PRs: SwiftFixIt: Skip duplicate insertion fix-its #8892

  • Risk: Low.

  • Testing: Added regression tests.

  • Reviewers: @xedin @dschaefer2

There are various scenarios — most notably involving protocol
compositions — where multiple different sites are diagnosed with the
same insertion fix-it. For example, compiling the following code with
`-enable-upcoming-feature InferIsolatedConformances:migrate` generates 2
warnings with equal fix-its for prepending `nonisolated` to the
composition:

```swift
protocol P {}
protocol Q {}

@mainactor struct S: P & Q {}
```

Applying both fix-its will produce invalid code:
`@MainActor struct S: nonisolated nonisolated P & Q {}`.

(cherry picked from commit 9034e62)
@AnthonyLatsis
Copy link
Contributor Author

@swift-ci please test

@AnthonyLatsis AnthonyLatsis enabled auto-merge (rebase) July 9, 2025 19:41
@AnthonyLatsis
Copy link
Contributor Author

@swift-ci please test Windows

@AnthonyLatsis AnthonyLatsis merged commit c506bdc into release/6.2 Jul 10, 2025
6 checks passed
@AnthonyLatsis AnthonyLatsis deleted the jepa-6.2 branch July 10, 2025 05:35
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.

3 participants