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.
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
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.
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
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
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.
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.
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.
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".
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
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.
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
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.
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
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
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
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.
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
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