Commit Graph

632 Commits

Author SHA1 Message Date
Ryan Mansfield 03f27338ac [test] Mark watchos-armv7k unsupported for tests emitting IR/objects targeting watchOS >= 9.0
These tests use abi-triple substitutions that resolve to watchOS >= 9.0 on
armv7k, which the driver rejects. This was exposed when the test runner
switched to the new swift-driver in #85930; the legacy driver did not
enforce this check.
2026-05-26 08:18:51 -04:00
Konrad `ktoso` Malawski 152c702d70 [Concurrency] Revert typed throws adoption from Task initializers (#88172)
Typed throws inference is causing too many previously working code to
break, so we cannot land this adoption.

I kept the "in source" impls rather than going back to `gyb` because
that was a pain as well...

Running in CI to verify first.

Resolves rdar://173501057
2026-03-31 08:09:40 +09:00
Aviva Ruben 69b6c8cc9e [Sema] Suggest let, nonisolated for properties and computed properties
Fixes rdar://89864078, by checking if all the required vars are
immutable, and suggesting mutable variables be converted to immutable to
become nonisolated and presumably fix the isolation issue. Also suggests
'nonisolated' on var decls without storage or wrapper. Additionally,
converts existing 'nonisolated' for method suggestion to emit per-method
instead of a top level 'all', for consistency with the new diagnostic,
based on PR feedback.
2026-03-23 15:42:18 -07:00
Konrad `ktoso` Malawski 81446666e7 [Concurrency] Remove non-throwing overloads of task inits (#87822)
Given that now we have throws(Failure) and it should default to
throws(Never) nicely, we may be able to get rid of a number of
overloads.

Quick analysis of resulting APIs since it's hard to see the impact of
the gyb changes otherwise:

```
  ┌───────────────────────────────────┬─────────────────────────────┬─────────────────────┐
  │              API                  │           Before            │        After        │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.init (5.1)                   │ 2 (non-throwing + throwing) │ 1 (throws(Failure)) │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.detached (5.1)               │ 2                           │ 1                   │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.init (6.0, TaskExecutor)     │ 2                           │ 1                   │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.detached (6.0, TaskExecutor) │ 2                           │ 1                   │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.immediate                    │ 2                           │ 1                   │
  ├───────────────────────────────────┼─────────────────────────────┼─────────────────────┤
  │ Task.immediateDetached            │ 2                           │ 1                   │
  └───────────────────────────────────┴─────────────────────────────┴─────────────────────┘
```

(ai assisted table)

- [x] de-gyb-ify 

rdar://172327403
2026-03-19 08:44:36 +09:00
Konrad `ktoso` Malawski 791f0796e2 [Distributed] Prevent dead code elimination of distributed funcs, thunks, witnesses (#87901)
Dead code elimination is not aware of the fact that distributed function
accessors and witnesses are actually used by the runtime, and therefore
may remove them. 🧟

This seems to have flown under the radar however when whole module
optimization is enabled in release mode this can trigger reliably and
result in pointing at deleted witnesses.

This PR mades a few cleanups in the way we mark and handle distributed
accessors so they don't get optimized away.

This is an additional fix on top of
https://github.com/swiftlang/swift/pull/87453

Resolves rdar://168881945
2026-03-18 22:20:24 +09:00
Michael Gottesman 8fe11fd17c Fix a test 2026-03-08 22:16:14 -07:00
Konrad `ktoso` Malawski 4c1e2c55cc [Distributed] distributed accessor fixes against optimization (#87453)
WIP, still not enough

resolves rdar://168881945
2026-03-02 13:46:11 +09:00
Allan Shortlidge 25309253b2 test: Use deployment targets instead of availability in some tests
Simplify a few tests that were making heavy use of availability annotations
that can be avoided by setting a Swift release aligned deployment target.
2026-02-25 09:20:11 -08:00
Konrad `ktoso` Malawski 19bba5d86f [Distributed] add test for package import and declaration (#86570) 2026-01-15 02:02:58 -08:00
Jamie 2c4e26b94f [test]: update existing tests for new fixit 2025-12-06 04:05:44 -06:00
Ryan Mansfield de9ed59a00 [Test] Add executable_test requirement to distributed actor test
rdar://163875444
2025-11-26 11:06:11 -05:00
Kavon Farvardin 10d80531fd Distributed: reenable distributed_actor_init_local.swift
The issue in rdar://92952551 appears to have been resolved.
2025-11-19 17:35:18 -08:00
Kavon Farvardin 7c6d54efa6 OpaqueValues: fix emitDistributedActorSystemWitnessCall
This code was not consulting SILFunctionConventions, so it was
passing things indirect when they are not in sil-opaque-values.

This fixes callers as well to ensure they pass arguments and
results correctly in both modes.
2025-11-19 17:35:14 -08:00
Erik Eckstein 62786b01e2 Optimizer: add the mandatory destroy hoisting pass
It hoists `destroy_value` instructions for non-lexical values.

```
  %1 = some_ownedValue
  ...
  last_use(%1)
  ... // other instructions
  destroy_value %1
```
->
```
  %1 = some_ownedValue
  ...
  last_use(%1)
  destroy_value %1    // <- moved after the last use
  ... // other instructions
```

In contrast to non-mandatory optimization passes, this is the only pass which hoists destroys over deinit-barriers.
This ensures consistent behavior in -Onone and optimized builds.
2025-11-06 21:00:44 +01:00
Hamish Knight 01f3cb6017 [test] Fix typo in rdar162800185.swift
I meant to use `%t` here.
2025-11-04 13:54:34 +00:00
Hamish Knight 0f58eb2104 [Sema] Fix and cleanup distributed id/actorSystem synthesis (#85245) 2025-11-04 10:17:05 +09:00
Anthony Latsis e0ca132af2 Merge pull request #85102 from swiftlang/jepa-main2
[test] Remove pre-rebranch `nocapture` matches
2025-10-29 22:21:38 +00:00
Anthony Latsis b5aec4cc34 [test] Remove pre-rebranch nocapture matches
These were added in https://github.com/swiftlang/swift/pull/81375 (and
several other follow-up PRs because we missed a few places) and
are no longer needed.
2025-10-24 02:07:22 +01:00
Konrad Malawski 208c7aeafa [Distributed] Make sure we copy @available and spi for resolvable extensions
Relates to rdar://162800185
2025-10-17 09:27:00 +09:00
Henrik G. Olsson cbc0ec3b88 Add -verify-ignore-unrelated where necessary (NFC)
These are tests that fail in the next commit without this flag. This
does not add -verify-ignore-unrelated to all tests with -verify, only
the ones that would fail without it. This is NFC since this flag is
currently a no-op.
2025-10-04 14:19:52 -07:00
Sima Nerush 7122a11b43 Merge pull request #79895 from simanerush/allow-explicit-nonisolated-for-lazy-and-prop-wrappers
[Concurrency] Allow explicit 'nonisolated' on lazy properties and properties with property wrappers if they are a member of a non-'Sendable' type.
2025-10-01 15:53:43 -07:00
Ramon Asuncion a7cf3ecd95 [Test][Distributed] Apply %env- subtituion to environment varibles in RUN lines 2025-09-30 06:03:33 -07:00
Ramon Asuncion 09b6499b94 [Test][Distributed] Convert VAR=value to env VAR=value for Lit shell
Convert `VAR=value cmd` to `env VAR=value cmd` in Distributed tests to ensure compatibility with LLVM Lit’s internal shell.

Partially address #84407
2025-09-29 07:59:40 -07:00
Sima Nerush c10bdf13d5 [Concurrency] Make sure to check 'nonisolated' on distributed actors first. 2025-09-24 18:20:23 -07:00
Sima Nerush 0f7d39dae8 [Concurrency] Allow explicit 'nonisolated' on lazy properties and properties with property wrappers if they are a member of a non-'Sendable' type. 2025-09-24 18:20:23 -07:00
Henrik G. Olsson c82e85d065 Merge pull request #84336 from hnrklssn/verify-macros
[Frontend] Add support for named target buffer in -verify expected lines
2025-09-23 10:28:07 -07:00
Hamish Knight 0bfbe987b4 [AST] Print ErrorType as _
In preparation for removing UnresolvedType in favor of ErrorType,
start printing ErrorType as `_` unless we've enabled debug printing.
`<<error type>>` should never be presented to the user, instead `_`
now just consistently means "unknown type".
2025-09-21 23:19:06 +01:00
Konrad Malawski f455f3c886 [Distributed] add availability annotations in test
resolves rdar://159314393
2025-09-20 10:37:25 +09:00
Henrik G. Olsson b2069a3e66 Update tests with diagnostics in macro expansions 2025-09-18 16:41:07 -07:00
Konrad Malawski 9c0c70be5d [Distributed] Allow disabling SerializationRequirement by using Any
It should be possible to disable SerializationRequirement by assigning
Any to it. This effectively disables the checking, since any type
conforms to that.

Previously we would crash trying to check for this conformance; or
rather, emitting diagnostics about un-necessary casts then encountering
incomplete types in CSDiagnostics.

Avoiding the cast entirely sounds like a good solution here.

resolves rdar://159285863
2025-09-05 17:02:07 +09:00
Konrad Malawski ced1756142 [Concurrency/Distributed] ensure distributed thunks are @concurrent
Otherwise the "nonisolated nonsending by default" mode blows up as
distributed thunk signatures dont match expectations.

This undoes the fix from https://github.com/swiftlang/swift/pull/83940
and applies the fix on the synthesis side of the distributed thunks,
such that they are @concurrent always -- which keeps their old semantics
basically, regardless of what "default" mode we have.
2025-09-03 18:54:09 +09:00
Konrad Malawski c1491c8022 [Concurrency/Distributed] nonisolated-nonsending by default breaks distributed thunks
the new NonisolatedNonsendingByDefault upcoming feature breaks remote
calls in distributed actors, because the expected isolation doesn't
match and the runtime swift_distributed_execute_target_resume will
crash.

This is a short term fix to unblock adopters, however preferably we
should mark the thunks as nonisolated(nonsending), though that seems to
be more involved.

resolves rdar://159247975
2025-08-28 21:53:41 +09:00
Konrad 'ktoso' Malawski d4ec0fb439 [Distributed] fix target triple in lib evolution test 2025-08-22 11:42:01 +09:00
Evan Wilde 6ca4895635 Merge pull request #83319 from etcwilde/ewilde/more-freebsd-tests
FreeBSD: Fix more compiler tests
2025-07-28 18:14:50 -07:00
Evan Wilde 698dbc03f1 FreeBSD: Disable broken tests
Disabling a few tests. The distributed tests are failing for the same
reason they fail on Linux, the rpaths and library search paths are
mucked up. Fixing that shouldn't be too hard, but should be enabled on
both platforms at once.

CollectiveTransformers doesn't work because it imports Darwin directly.
There is a note that is several years old saying that we should port the
test to the other platforms, but that is beyond the scope of this PR at
the moment.
2025-07-24 17:36:59 -07:00
Konrad 'ktoso' Malawski a67193d4a4 [Distributed] Disable irgen test on iOS
Or rather, the simulator. but there's no need to run it there to begin
with.

We'll be getting failures like:

```
line 2: .../llvm-macosx-x86_64/./bin/split-file: No such file or directory
```
if we try

resolves rdar://155987313
2025-07-24 23:01:19 +09:00
Konrad 'ktoso' Malawski b7aaba491e Test: add some missing plugin paths to distributed tests 2025-07-23 19:23:01 +09:00
Konrad 'ktoso' Malawski 03774d245a fix some tests due to diagnostic rewording 2025-07-15 11:16:13 +09:00
Konrad 'ktoso' Malawski f52f445358 [Concurrency] add fixit to add final to non-sendable class -> Sendable
The previous message was just suggesting unchecked Sendable, but instead
we should be suggesting to add final to the class. We also don't
outright suggest using unchecked Sendable -- following
https://github.com/swiftlang/swift/pull/81738 precedent.

Resolves rdar://155790695
2025-07-15 10:42:25 +09:00
nate-chandler fa786c8413 Merge pull request #82512 from nate-chandler/rdar114453974
[Test] Fix disablement line.
2025-06-27 15:40:43 -07:00
Nate Chandler 7048e963fd [Test] Fix disablement line.
Use the right issue number to disable this test.
2025-06-25 16:46:59 -07:00
(null) d6811260a9 Merge commit '665515c781999a81094bbe4f8302a7cb1a6a6b39' into mchiu/freebsd 2025-06-17 15:12:23 -04:00
Michael Gottesman f31236931b Change send-never-sendable of isolated partial applies to use SIL level info instead of AST info.
The reason I am doing this is that we have gotten reports about certain test
cases where we are emitting errors about self being captured in isolated
closures where the sourceloc is invalid. The reason why this happened is that
the decl returned by getIsolationCrossing did not have a SourceLoc since self
was being used implicitly.

In this commit I fix that issue by using SIL level information instead of AST
level information. This guarantees that we get an appropriate SourceLoc. As an
additional benefit, this fixed some extant errors where due to some sort of bug
in the AST, we were saying that a value was nonisolated when it was actor
isolated in some of the error msgs.

rdar://151955519
2025-06-10 08:09:32 -07:00
Konrad 'ktoso' Malawski cedcd4afc6 [Distributed] enable additional testing in library evolution mode
We had a number of problems either "only in" or "only without" library
evolution and protocols, so in order to increase the test coverage, run
a few of the crucial tests in both modes.
2025-06-06 07:06:11 +09:00
Konrad 'ktoso' Malawski 30d54531a7 [Distributed] Don't drop dist get accessors from witness tables.
This actually manifested as an pointer auth crash, but the real reason
being is that we messed up the order of elements in the witness table.
If we'd skip the accessor like this, the types we sign/auth with would
no longer align and manifest in a crash.

There is no real reason to skip this entry so we just bring it back, and
avoid making this special in any way.

This unlocks a few tests as well as corrects any distributed+protocol
use where a requirement distributed var was _followed by_ other
requirements.

resolves rdar://125628060
2025-06-05 16:58:00 +09:00
Konrad `ktoso` Malawski 78c68ee069 Merge pull request #81805 from ktoso/wip-distributed-fixes 2025-06-03 18:22:22 +09:00
Michael Gottesman 331626e6fa [rbi] Lookthrough an invocation of DistributedActor.asLocalActor when determining actor instances.
In this case, what is happening is that in SILGen, we insert implicit
DistributedActor.asLocalActor calls to convert a distributed actor to its local
any Actor typed form. The intention is that the actor parameter and result are
considered the same... but there is nothing at the SIL level to enforce that. In
this commit, I change ActorInstance (the utility that defines actor identity at
a value level) to look through such a call.

I implemented this by just recognizing the decl directly. We already do this in
parts of SILGen, so I don't really see a problem with doing this. It also
provides a nice benefit that we do not have to modify SILFunctionType to
represent this or put a @_semantic attribute on the getter.

NOTE: Generally, Sema prevents us from mixing together different actors. In this
case, Sema does not help us since this call is inserted implicitly by the
distributed actor implementation in SILGen. So this is not a problem in general.

rdar://152436817
2025-06-02 12:21:55 -07:00
Michael Chiu 7bbafc599d Merge branch 'main' into mchiu/freebsd 2025-06-02 13:33:18 -04:00
Konrad 'ktoso' Malawski fb6453c64c [Distributed] IRGen mangler must mangle distributed thunk 2025-06-02 13:34:09 +09:00
Konrad `ktoso` Malawski 8b4740f0cc Merge pull request #81797 from ktoso/wip-handle-public-import-distributed-awareness
[Distributed] account Distributed module use from DA declarations
2025-05-29 08:04:24 +09:00