Skip to content

[Sema] Skip redundant MainActor suggestion on conformance#88602

Open
qflen wants to merge 1 commit intoswiftlang:mainfrom
qflen:fix-redundant-isolate-conformance-note
Open

[Sema] Skip redundant MainActor suggestion on conformance#88602
qflen wants to merge 1 commit intoswiftlang:mainfrom
qflen:fix-redundant-isolate-conformance-note

Conversation

@qflen
Copy link
Copy Markdown

@qflen qflen commented Apr 22, 2026

Summary

  • Fixes "isolate this conformance with @MainActor" suggested when @MainActor already present #87776: the note advising to "isolate this conformance to the main actor with @MainActor" fired even when the conforming nominal already carried @MainActor, producing a redundant fix-it.
  • In diagnoseConformanceIsolationErrors, skip the suggestion when getActorIsolation(nominal) matches the accumulated potentialIsolation, unless the conformance is explicitly nonisolated (in which case the note still fires as a prompt to reconsider).
  • Fixes a latent assertion in isolationsMatch that fired when either isolation was neither a global actor nor an actor instance.

Test plan

  • test/Concurrency/isolated_conformance.swift (incl. new Issue87776 regression): 1/1 passed.
  • Full test/Concurrency suite: 451/451 supported passed, 14 unsupported, 0 failures.

@qflen qflen requested a review from a team as a code owner April 22, 2026 01:44
@qflen qflen changed the title [Sema] Suppress redundant @MainActor conformance suggestion [Sema] Skip redundant MainActor suggestion on conformance Apr 22, 2026
Fixes swiftlang#87776. When the conforming nominal already carries the
suggested global actor, skip the note that advises isolating
the conformance to that actor: writing the attribute on the
conformance would be redundant with the nominal's isolation.
The suggestion still fires for nominals with a different or no
global actor, and for conformances explicitly marked 'nonisolated'
(a deliberate user choice that may warrant reconsideration).

Also fixes a latent assertion failure in isolationsMatch when an
isolation is neither a global actor nor an actor instance.
@qflen qflen force-pushed the fix-redundant-isolate-conformance-note branch from 3ca6867 to e394bdb Compare April 22, 2026 02: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.

"isolate this conformance with @MainActor" suggested when @MainActor already present

1 participant