Skip to content

[Concurrency] Fix a few issues with Senable and Any #79382

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
Feb 15, 2025

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Feb 14, 2025

  • Sendable-to-Any: Allow conversion when in inout positions

    It should be possible to pass values with any Sendable as arguments
    to inout parameters that expect Any. This is pretty much the same
    as an l-value conversion.

  • Make sure that @preconcurrency use is detected in base expressions

    This expands [Concurrency] Handle self apply exprs when computing @preconcurency in the availability checker. #77510 to base
    expressions of calls, subscripts and members to make sure that if
    the base has @preconcurrency declaration at some level. Otherwise,
    the availability checker won't appropriately downgrade unavailable
    Sendable conformances for @preconcurrency declarations.

Resolves: #79361
Resolves: rdar://144794132

…whether access is mutating or not

Otherwise `inout` uses of declarations that require ABI safe conversions
are going to be diagnosed as non-mutating.
…positions

It should be possible to pass values with `any Sendable` as arguments
to `inout` parameters that expect `Any`. This is pretty much the same
as an l-value conversion.

Resolves: swiftlang#79361
Resolves: rdar://144794132
…expressions

This expands swiftlang#77510 to base
expressions of calls, subscripts and members to make sure that if
the base has `@preconcurrency` declaration at some level. Otherwise,
the availability checker won't appropriately downgrade unavailable
`Sendable` conformances for `@preconcurrency` declarations.
@xedin
Copy link
Contributor Author

xedin commented Feb 14, 2025

swiftlang/swift-foundation#1169
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Feb 14, 2025

swiftlang/swift-foundation#1169
@swift-ci please build toolchain linux

@xedin
Copy link
Contributor Author

xedin commented Feb 14, 2025

@jmschonfeld and @bnbarham looks like sourcekit-lsp has decoder.userInfo = userInfo expression, this is something we cannot support because preconcurrency declaration appears on the left-hand side of an assignment.

…ignments

If destination is marked as `@preconcurrency` the Sendable conformance
errors should be downgraded to warnings even in Swift 6 mode just like
for member and subscript references.
@xedin
Copy link
Contributor Author

xedin commented Feb 14, 2025

Turns out I mixed that up with another situation where any Sendable -> Any happens on the other side of the assignment.

@xedin
Copy link
Contributor Author

xedin commented Feb 14, 2025

swiftlang/swift-foundation#1169
@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Feb 15, 2025

@swift-ci please test Windows platform

1 similar comment
@xedin
Copy link
Contributor Author

xedin commented Feb 15, 2025

@swift-ci please test Windows platform

@xedin xedin merged commit 9cbd8e1 into swiftlang:main Feb 15, 2025
5 checks passed
ahoppen added a commit to ahoppen/swift-docc-symbolkit that referenced this pull request Mar 8, 2025
ahoppen added a commit to ahoppen/swift-docc-symbolkit that referenced this pull request Mar 8, 2025
This fixes build failures for setups that have swiftlang/swift-foundation#1169 but not swiftlang/swift#79382.

rdar://145669600
ahoppen added a commit to ahoppen/swift-docc-symbolkit that referenced this pull request Mar 8, 2025
This fixes build failures for setups that have swiftlang/swift-foundation#1169 but not swiftlang/swift#79382.

rdar://145669600
ahoppen added a commit to ahoppen/swift-docc-symbolkit that referenced this pull request Mar 8, 2025
QuietMisdreavus pushed a commit to swiftlang/swift-docc-symbolkit that referenced this pull request Mar 10, 2025
…e]` (#96)

This fixes build failures for setups that have swiftlang/swift-foundation#1169 but not swiftlang/swift#79382.

rdar://145669600
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.

Any vs. any Sendable discrepancies are marked as errors for uses of inout properties
2 participants