Fix non-sendable data seen as sendable in generic recover blocks#4953
Merged
SeanTAllen merged 1 commit intomainfrom Mar 11, 2026
Merged
Fix non-sendable data seen as sendable in generic recover blocks#4953SeanTAllen merged 1 commit intomainfrom
SeanTAllen merged 1 commit intomainfrom
Conversation
The sendable() function's TK_ARROW handler used viewpoint_upper() to compute a single bound, then checked sendability of that bound. For generic arrow types like this->(T #any !), viewpoint_upper treats this as box, and cap_view_upper(box, #alias) yields tag — which is sendable. But concrete instantiations like ref->(T #any !) = T #alias are NOT sendable. Replace the single-bound computation with case-splitting: enumerate the concrete capabilities the left side could be (matching the sets used by viewpoint_reifythis and viewpoint_reifytypeparam for subtype checking) and check that ALL produce sendable types. Concrete-cap arrow types still use viewpoint_upper directly, preserving the #4244 fix. Closes #4459 Design: #4949
jemc
approved these changes
Mar 11, 2026
Member
jemc
left a comment
There was a problem hiding this comment.
Consider moving the generic->concrete code to a helper function that could be reused, but doesn't matter that much.
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.
The compiler's
sendable()function incorrectly classified generic arrow types likethis->(T #any !)as sendable.viewpoint_uppertreatsthisasbox, andcap_view_upper(box, #alias)yieldstag— which is sendable. But concrete instantiations likeref->(T #any !) = T #aliasare not sendable, allowing unsound recovery of non-sendable data.The fix replaces the single-bound computation in
sendable()'sTK_ARROWhandler with case-splitting: enumerate the concrete capabilities the left side could be (matching the sets used byviewpoint_reifythisandviewpoint_reifytypeparamfor subtype checking) and check that ALL produce sendable types. Concrete-cap arrow types still useviewpoint_upperdirectly, preserving the #4244 fix.Filed #4952 as follow-up for
immutable_or_opaque()which may have an analogous issue.Closes #4459
Design: #4949