Commit Graph

28352 Commits

Author SHA1 Message Date
Slava Pestov
4937d0a242 Merge pull request #79134 from slavapestov/smaller-potential-bindings
Sema: More accurate undo() of PotentialBindings::retract()
2025-02-05 14:05:05 -05:00
Pavel Yaskevich
aad858d66c [Sema] Implement validation of @execution(...) in type context 2025-02-05 10:11:38 -08:00
Doug Gregor
246e130584 Merge pull request #79144 from DougGregor/distributed-typed-throws
Ensure that distributed functions with typed throws can be called from outside the actor
2025-02-05 01:21:22 -08:00
Michael Gottesman
c846306f63 Merge pull request #79145 from gottesmm/pr-4f8d798bbab9e98210dd45e18e92720f7c73cc7d
[concurrency] Split out the default inferred actor isolation computation into a helper from ActorIsolationRequest::evaluate.
2025-02-04 23:09:38 -08:00
Cal Stephens
684c908564 Prevent nested closure in 'extension Optional' from unexpectedly being allowed 2025-02-04 18:49:42 -08:00
Michael Gottesman
5d6131e16b [concurrency] Split out the default inferred actor isolation computation into a helper from ActorIsolationRequest::evaluate.
NFC.
2025-02-04 17:30:05 -08:00
Slava Pestov
8a3300baa1 Sema: We no longer call PotentialBindings::infer() from undo() 2025-02-04 20:26:53 -05:00
Slava Pestov
09f78bfd95 Sema: Remove now-unused ConstraintGraph::inferBindings() 2025-02-04 20:26:12 -05:00
Slava Pestov
cda3cda132 Sema: Rework change recording in PotentialBindings::retract()
Instead of making an undo() do an infer(), let's record fine-grained
changes about what was retracted, and directly re-insert the same
elements into the data structures.
2025-02-04 20:26:12 -05:00
Allan Shortlidge
8534f29ef5 Merge pull request #79122 from tshortli/loosen-more-available-than-enclosing-extension
Sema: Loosen more available than enclosing extension diagnostic
2025-02-04 16:31:20 -08:00
Doug Gregor
84ed66f3be Ensure that distributed functions with typed throws can be called from outside
When calling a distributed function for an actor that might not be local,
the call can throw due to the distributed actor system producing an
error. The function might, independently, also throw. When the
function uses typed throws, we incorrectly treated the call is if it
would always throw the error type specified by the function. This
leads to incorrectly accepting invalid code, and compiler crashes in
SILGen.

The change here is to always mark calls to distributed functions
outside the actor as "implicitly throwing", which makes sure that we
treat the call sites as throwing 'any Error'. The actual handling of
the typed throw (from the local function) and the untyped throw (from
the distributed actor system) occurs in thunk generation in SILGen,
and was already handled correctly.

Fixes rdar://144093249, and undoes the ban introduced by rdar://136467528
2025-02-04 16:06:51 -08:00
Slava Pestov
b09c6733d3 Sema: Change a few fields of PotentialBindings from SmallDenseSet to SmallVector
These are not going to have duplicates by construction.
2025-02-04 16:38:55 -05:00
Allan Shortlidge
4d94d55fc8 Merge pull request #79098 from tshortli/consolidate-unexpected-available-versions-diagnostic
Parse/Sema: Consolidate diagnostics for unexpected versions
2025-02-04 10:05:58 -08:00
Slava Pestov
4b1cb12b6c Sema: Sink PotentialBindings::Defaults down into BindingSet 2025-02-03 20:38:06 -05:00
Slava Pestov
6ea39d2415 Sema: Sink PotentialBindings::Literals down into BindingSet 2025-02-03 17:19:22 -05:00
Slava Pestov
466c7708e2 Sema: Sink PotentialBindings::Protocols down into BindingSet 2025-02-03 17:19:22 -05:00
Slava Pestov
baa1ee9fb9 Sema: Move BindingSet::BindingSet to CSBindings.cpp 2025-02-03 17:19:22 -05:00
Allan Shortlidge
aed1a013e4 Sema: Loosen more available than enclosing extension diagnostic.
When diagnosing a declaration that is more available than its context, to
preserve source compatibility we need to downgrade the diagnostic to a warning
when the outermost declaration is an extension. This logic regressed with
https://github.com/swiftlang/swift/pull/77950 and my earlier attempt to fix
this (https://github.com/swiftlang/swift/pull/78832) misidentified what had
regressed.

Really resolves rdar://143423070.
2025-02-03 14:07:27 -08:00
Michael Gottesman
543b1e6ca3 [concurrency] Make ActorIsolation::Nonisolated -> CallerIsolationInheriting and delete CallerIsolationInheriting. 2025-02-03 10:56:08 -08:00
Michael Gottesman
0cb64638d0 [concurrency] Add Concurrent/ConcurrentUnsafe and use it instead of ActorIsolation::Nonisolated.
This is just the first part of a larger transition.
2025-02-03 10:56:06 -08:00
Erik Eckstein
ed4863f76c Sema: don't use llvm::StringSwitch for runtime function names
Using `llvm::StringSwitch` with this many cases causes clang to crash due to a stack overflow.
Works around rdar://143944155
2025-02-03 09:54:07 +01:00
Cal Stephens
be0e68eca3 Add more test cases, simplify logic 2025-02-02 19:28:18 -08:00
Cal Stephens
f2cda5efe3 Merge tag 'swift-DEVELOPMENT-SNAPSHOT-2025-01-31-a' of github.com:swiftlang/swift into cal--fix-nested-weak-self-issue
Tag build swift-DEVELOPMENT-SNAPSHOT-2025-01-31-a
2025-02-02 14:18:15 -08:00
Allan Shortlidge
427c8affef Parse/Sema: Consolidate diagnostics for unexpected versions.
Since resolving the domain of an `@available` attribute is done during type
checking now, diagnostics about unexpected versions for a domain need to be
emitted at that point instead of during parsing. It doesn't make sense to
maintain the special version of this diagnostic that is emitted during parsing
for the universal availability domain only.
2025-02-02 09:57:43 -08:00
Slava Pestov
f35dd66b77 Revert "Sema: Don't generate OneWayEqual constraints for pattern bindings"
This reverts commit 5071e96a78.
2025-02-02 00:43:15 -05:00
Slava Pestov
5b4218c38d Revert "Sema: Remove ConstraintKind::OneWayEqual"
This reverts commit 385d66f24e.
2025-02-02 00:43:15 -05:00
Slava Pestov
fa73be2415 Revert "Sema: Remove one-way constraint handling from computeConnectedComponents()"
This reverts commit dd3e49c3ac.
2025-02-02 00:43:15 -05:00
Slava Pestov
8af183cca8 Revert "Sema: Remove DependentComponentSplitterStep"
This reverts commit 9fb6d9251e.
2025-02-02 00:43:15 -05:00
Slava Pestov
8800c3b630 Revert "Sema: Simplify depthFirstSearch() a bit now that it only has one caller"
This reverts commit 25ad700fb0.
2025-02-02 00:43:15 -05:00
Slava Pestov
99595e615e Revert "Sema: Split up gatherConstraints() into gatherAllConstraints() and gatherNearbyConstraints()"
This reverts commit 2230c3a17e.
2025-02-02 00:43:15 -05:00
Allan Shortlidge
afd99725eb Merge pull request #79070 from tshortli/model-custom-availability-domains
AST/Sema: Model custom availability domains
2025-02-01 14:09:37 -08:00
Allan Shortlidge
79c017377d Parse: Temporarily revert removal of diagnostic.
SourceKit-LSP tests depend on the exact behavior of this diagnostic (which I
don't plan to preserve) so I'm reverting the consolidation temporarily to get
unblocked.
2025-02-01 10:07:20 -08:00
Pavel Yaskevich
d245dac784 Merge pull request #79086 from xedin/small-solver-perf-optimizations
[CSOptimizer] A few small performance optimizations
2025-01-31 21:20:50 -08:00
Allan Shortlidge
1e76f19be9 Sema: Reject version specs in @available attributes for custom domains. 2025-01-31 17:31:13 -08:00
Allan Shortlidge
5c61a2d53e Sema: Require experimental feature to use custom availability domains. 2025-01-31 17:31:13 -08:00
Allan Shortlidge
770ddad742 AST/Sema: Look up custom availability domains by name.
Store the domain definitions defined on the command line on the `ModuleDecl` for
the main module.
2025-01-31 17:31:13 -08:00
Allan Shortlidge
f9799aeba9 AST: Introduce a Custom availability domain kind. 2025-01-31 17:31:07 -08:00
Pavel Yaskevich
72340f39b8 [CSOptimizer] Look through OptionalEvaluationExprs when dealing with unapplied disjunctions
This improves performance for situations like `a?.b + 2` by
giving a high score to `b` which prioritizes it over an operator.
2025-01-31 13:07:29 -08:00
Pavel Yaskevich
6bc23b5057 [CSOptimizer] Don't consider disabled overloads when checking whether disjunction is supported
Non-operator disjunctions are supported only if all of their _active_
choices are concrete.
2025-01-31 13:06:51 -08:00
Alexis Laferrière
63c2979e13 Merge pull request #78471 from xymus/fix-accessor-is-spi
Sema: Accessors's SPI are tied to the attributes on the storage
2025-01-31 08:59:43 -08:00
Anthony Latsis
d585d1658d Merge pull request #78971 from AnthonyLatsis/amorphophallus-titanum 2025-01-31 08:37:44 +00:00
Anthony Latsis
34f9b80cbc Merge pull request #78750 from AnthonyLatsis/oryza-sativa
[Gardening] Fix some set but not used variables
2025-01-31 04:29:05 +00:00
Slava Pestov
adc16beb0e Merge pull request #79061 from slavapestov/fix-rdar143707820
Sema: Fix generic type alias resolution edge case
2025-01-30 21:33:23 -05:00
Anthony Latsis
a84dfc8387 [Gardening] Fix some set but not used variables 2025-01-30 21:34:38 +00:00
Holly Borla
c4b65be753 Merge pull request #79048 from hborla/delete-infer-public-sendable-flag
[Concurrency] Remove `EnableInferPublicSendable`.
2025-01-30 20:48:40 +00:00
Slava Pestov
7c6c5fcd50 Sema: Fix generic type alias resolution edge case
If a type alias in generic context fixes all outer generic
parameters to concrete types, we allow the type alias to
be referenced without specifying the generic arguments of
its parent type.

However, we need to reduce the underlying type in case it
was written in terms of the (fully concrete) generic
parameters.

Fixes rdar://problem/143707820.
2025-01-30 15:34:10 -05:00
Holly Borla
b3275d9db3 Merge pull request #79044 from hborla/default-actor-isolation-fixes
[Concurrency] Two isolation inference changes for default isolation mode.
2025-01-30 16:36:57 +00:00
Holly Borla
430d25f7e6 [Concurrency] Remove EnableInferPublicSendable. 2025-01-30 16:10:51 +00:00
Holly Borla
28948965dd [Concurrency] Two isolation inference changes for default isolation mode.
1. Non-actor initializers should participate in custom default isolation
   inference. Otherwise, they will not be able to touch the type's stored
   properties to initialize them if those properties have the default
   isolation inferred.
2. All declarations inside actors and distributed actors do not participate
   in default isolation inference; they remain unspecified, so the existing
   isolation inference rules apply.
2025-01-30 11:54:57 +00:00
Konrad `ktoso` Malawski
dee96d9516 Merge pull request #78978 from ktoso/wip-fix-error-type-distributed-throws 2025-01-30 11:36:23 +00:00