Skip to content
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

[6.1][CSApply] Sendable-to-Any: Add support for l-value to l-value and inout unsafe casts #78492

Merged
merged 4 commits into from
Jan 9, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jan 8, 2025

Cherry-pick of #78487


  • Explanation:

    Extends functionality of any Sendable -> Any conversion in
    generic argument positions to support subscripts and mutating accesses.

    This means that we cannot reply on simple type equality in some
    cases i.e. when applying base to self parameter. If type equality
    check fails we need to check whether the types are the same with
    deep equality restriction since any Sendable to Any conversion
    is now supported in generic argument positions of @preconcurrency
    declarations. i.e. referencing a member on [any Sendable] if member
    declared in an extension that expects Element to be equal to Any.

  • Main Branch PR: [CSApply] Sendable-to-Any: Add support for l-value to l-value and inout unsafe casts #78487

  • Resolves: rdar://140300022

  • Risk: Low (Extends functionality of the previous PR - [6.1][TypeChecker/SILGen] Allow any Sendable to match Any while matching generic arguments #78272 to support subscripts and mutating accesses).

  • Reviewed By: @hborla

  • Testing: Added new tests to the concurrency, SILGen, and interpreter test suites.

xedin added 3 commits January 8, 2025 10:01
`coerceToType` can to handle l-value -> inout correctly
and report better information if coercion fails.

(cherry picked from commit c225db4)
…econcurrency context

(cherry picked from commit b7a7839)
… equality

If type equality check fails we need to check whether the types
are the same with deep equality restriction since `any Sendable`
to `Any` conversion is now supported in generic argument positions
of @preconcurrency declarations. i.e. referencing a member on
`[any Sendable]` if member declared in an extension that expects
`Element` to be equal to `Any`.

(cherry picked from commit 79f6b07)
@xedin xedin requested a review from hborla January 8, 2025 18:09
@xedin xedin requested a review from a team as a code owner January 8, 2025 18:09
@xedin
Copy link
Contributor Author

xedin commented Jan 8, 2025

@swift-ci please test

`any Sendable` -> `Any` in generic argument positions should be
supported for l-value and inout types as well otherwise it won't
be possible to call setters and mutating methods.

(cherry picked from commit 0a0a34c)
@xedin xedin force-pushed the Sendable-to-Any-for-lvalues-6.1 branch from 43e95a7 to 4778032 Compare January 9, 2025 00:26
@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2025

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Jan 9, 2025

SILGen output is slightly different in 6.1 and has type annotations for casts.

@xedin xedin merged commit 5abc22e into swiftlang:release/6.1 Jan 9, 2025
5 checks passed
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.

2 participants