Commit Graph

24 Commits

Author SHA1 Message Date
Michael Gottesman
3ed4059a60 [sema] Change non-sendable -> non-Sendable in diagnostics.
This matches send non sendable but importantly also makes it clear that we are
talking about something that doesn't conform to the Sendable protocol which is
capitalized.

rdar://151802975
2025-05-22 11:37:58 -07:00
Slava Pestov
59ba1a0294 Sema: Fix request cycle due to unnecessary Sendable check with static method
Fixes rdar://139747886.
2024-11-13 15:16:28 -05:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Pavel Yaskevich
daab4e1c9e [ConstraintSystem] InferSenableFromCaptures: Fix treatment of partially applied instance methods on non-Sendable base
In situations like:

```
class A {
  func test() {}
}
```

Fully uncurried function type should be @Sendable but inner method
cannot be because it captures a non-Sendable type `A` when applied.
2024-09-02 00:23:07 -07:00
Pavel Yaskevich
05b0adac5d [ConstraintSystem] Use getNumApplications + ValueDecl::getNumCurryLevels to detect partial applications
We used to detect partial applications based on member locators
and parent expressions, but using function reference kind +
check to see if self is applied is such simpler and hits both
uses of `isPartialApplication`.
2024-08-30 17:04:46 -07:00
Pavel Yaskevich
67ee63d875 [ConstraintSystem] InferSendableFromCaptures: Mark unapplied operator references as @Sendable
Both of these functions are single-apply instance members,
even though their names could be compound the application
is still a regular call with like `next(isolation: ...)`
vs. `next(isolation:)(...)` it would have to be for a "compound"
application.

Operator references don't have a base type and could be found via
unqualified lookup, `adjustFunctionTypeForConcurrency` should handle
them specifically.

Resolves: rdar://131321053
2024-08-30 15:24:26 -07:00
Doug Gregor
95e12ca584 Don't apply @Sendable to enum cases in pattern matching 2024-06-13 11:56:18 -07:00
Doug Gregor
c65264738b Treat references to enum cases with associated values as @Sendable functions
When `InferSendableFromCaptures`, make sure to treat references to enum
cases that have associated values as `@Sendable` functions.
2024-06-12 14:58:56 -07:00
Doug Gregor
290ec7915b Respect @preconcurrency in the diagnostic for @Sendable methods of non-Sendable types 2024-05-16 21:36:37 -07:00
Pavel Yaskevich
6a60588fa1 [Tests] NFC: Add a test-case for rdar://125932231 2024-04-05 00:25:20 -07:00
Pavel Yaskevich
0a49d2868c Partially revert: "[TypeChecker] TypeChecker::isSubtypeOf should recognize @sendable subtyping"
Reverts code chagnes introduced by 5626881da1 but leaves (modified) test-cases

This approach regressed existing ternary expressions that join to `any Sendable`
and one branch is inferred from the ternary type variable.
2024-04-05 00:23:52 -07:00
Pavel Yaskevich
d6f57c932d [Tests] NFC: Add a test-case for rdar://119593407 2024-03-22 09:20:45 -07:00
Pavel Yaskevich
a7f9a689fc [ConstraintSystem] Move @Sendable inference for partially applied members to adjustFunctionTypeForConcurrency 2024-03-22 09:02:32 -07:00
Pavel Yaskevich
d49445beed Merge pull request #70502 from xedin/subtype-between-sendable-and-non-sendable
[TypeChecker] `TypeChecker::isSubtypeOf` should recognize Sendable s…
2024-03-08 12:05:43 -08:00
Holly Borla
9ba481ad53 [Diagnostics] Clarify the wording of error_in_future_swift_version. 2024-03-01 12:05:51 -08:00
Pavel Yaskevich
c7c7df3329 [Frontend] NFC: Promote InferSendableFromCaptures to an upcoming feature in Swift 6 2024-02-01 10:56:22 -08:00
Pavel Yaskevich
5626881da1 [TypeChecker] TypeChecker::isSubtypeOf should recognize @Sendable subtyping
A sendable function can be a subtype of a non-@Sendable function,
that is currently established via a fix. `TypeChecker::isSubtypeOf`
should recognize its presence and fail.
2023-12-20 11:01:40 -08:00
Pavel Yaskevich
a8232123c9 [ConstraintSystem] Fix isPartialApplication to properly handle static members
Only instance members require double-apply to be fully applied,
static members apply the base implicitly.
2023-11-29 17:00:38 -08:00
Angela Laar
c09ec72e85 [Constraint System] Always add Sendable to unapplied function applications 2023-11-07 13:37:24 -08:00
Angela Laar
619a517a61 [CSSimplify] Check all conditional requirements for a type variable 2023-10-25 12:30:50 -07:00
Angela Laar
4bd4fa6479 [Sema] Use checkGenericArguments 2023-10-25 12:30:27 -07:00
Angela Laar
34ca702031 [Frontend] Feature flag for InferredSendableMethods 2023-10-25 12:30:24 -07:00
Angela Laar
9e408af419 [Sema] Global funcs should always be Sendable
Global funcs should be Sendable by default because they don't
capture anything.
2023-10-25 12:29:37 -07:00
Angela Laar
4028f15f7b [test] add sendable method and function tests 2023-10-25 12:29:37 -07:00