Skip to content

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

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

Merged
merged 4 commits into from
Jan 8, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jan 8, 2025

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.

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.

xedin added 4 commits January 6, 2025 18:11
`coerceToType` can to handle l-value -> inout correctly
and report better information if coercion fails.
… 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`.
`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.
@xedin
Copy link
Contributor Author

xedin commented Jan 8, 2025

I reached out to @jckarter about SILGen side of this and we decided that it would be best to use existing ABISafeConversionExpr to model this.

@xedin
Copy link
Contributor Author

xedin commented Jan 8, 2025

@swift-ci please test

@xedin xedin changed the title [CSApply] Add support for l-value to l-value and inout unsafe casts [CSApply] Sendable-to-Any: Add support for l-value to l-value and inout unsafe casts Jan 8, 2025
@xedin xedin merged commit 8f7e71a into swiftlang:main Jan 8, 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