Skip to content

Fix non-sendable data seen as sendable in generic recover blocks#4953

Merged
SeanTAllen merged 1 commit intomainfrom
fix-generic-recover-sendable
Mar 11, 2026
Merged

Fix non-sendable data seen as sendable in generic recover blocks#4953
SeanTAllen merged 1 commit intomainfrom
fix-generic-recover-sendable

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

The compiler's sendable() function incorrectly classified generic arrow types like this->(T #any !) as sendable. 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, allowing unsound recovery of non-sendable data.

The fix replaces the single-bound computation in sendable()'s TK_ARROW handler 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.

Filed #4952 as follow-up for immutable_or_opaque() which may have an analogous issue.

Closes #4459
Design: #4949

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
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Mar 7, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Mar 7, 2026
@SeanTAllen SeanTAllen marked this pull request as ready for review March 7, 2026 18:50
Copy link
Copy Markdown
Member

@jemc jemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving the generic->concrete code to a helper function that could be reused, but doesn't matter that much.

@SeanTAllen SeanTAllen merged commit 4316270 into main Mar 11, 2026
30 checks passed
@SeanTAllen SeanTAllen deleted the fix-generic-recover-sendable branch March 11, 2026 19:32
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Mar 11, 2026
github-actions bot pushed a commit that referenced this pull request Mar 11, 2026
github-actions bot pushed a commit that referenced this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-sendable data seen as sendable

3 participants