Repository navigation
Conversation
Qualify the rotor's captured `elements` access and snapshot the text size variant before the escaping Foundation callback. This removes the implicit- self and mutating-self diagnostics when the Foundation callback is escaping. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two escaping callbacks capture state implicitly. This makes both captures explicit:
AccessibilityLinkRotorBridge.update()writesself.elementsinside theenumerateAttributecallback.DynamicTextHelper.widthAdaptedTextreads thesizeVariantproperty inside theenumerateAttributecallback; it now reads it once into a local before the callback.Why
With a Foundation whose
enumerateAttribute/enumerateAttributescallback is@escaping(the Foundation used by our Darling work, not Apple's), the unchanged code produces the implicit-self diagnostic in the rotor and the mutating-self capture diagnostic in the lazy var of a struct. Apple's Foundation declares the callback non-escaping, so behaviour there is unchanged. The change has no effect on behaviour: the same values are used, they are just named or read earlier.Provenance
Local commit from 2026-10-15 (Cristian Magherusan-Stanciu), originally two commits on 2026-10-13 combined into one. It applies to current
mainwithout changes; I reworded the message.Testing
Not compiled with this repo's package build, and no tests run: no Swift toolchain is available on the machine where I prepared this port. The original author reported, for the original commit, reduced-source red/green checks with Swift 6.3.3 (the unchanged expressions reproduce the diagnostics, the changed ones emit SIL without them). The complete OpenSwiftUI package, link and runtime were not verified then either. No test was added: the change has no runtime-visible effect on Apple platforms.
🤖 Generated with Claude Code