Skip to content

[pull] swiftwasm from main #4354

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 146 commits into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
db97c0d
[APIJSON] Impromve tests to it doesn't rely on SDK content
cachemeifyoucan Mar 3, 2022
837586f
[Concurrency] Use separate signpost name for task_flags_changed.
mikeash Mar 4, 2022
4b85670
[swift-inspect] Fix some missing type conversions when targeting watc…
mikeash Mar 4, 2022
b7ceca3
visualc: add new `_visualc_intrinsics` module
compnerd Mar 6, 2022
9ad8798
Fix typo in getting started, and update example for creating the cxx…
cabmeurer Mar 7, 2022
bcddc9b
[utils] Force subprocess output to be read in text mode
lorentey Mar 8, 2022
040a4a3
[Concurrency][Distributed] Move AnyActor to Concurrency module
ktoso Mar 8, 2022
369f3e6
[Concurrency] ignore @_marker protocol AnyActor ABI warnings
ktoso Mar 8, 2022
e8891b6
[test] XFAIL dependent-types.swift on 32 bit platforms
hamishknight Mar 8, 2022
f789974
Cleaning up anchor finding in interpolated strings
etcwilde Mar 8, 2022
02a13f3
Allow explicit "as <existential-type>" to disable implicit opening of…
DougGregor Mar 1, 2022
8224335
Remove dead find/filter-Constraints functions from the constraint solver
DougGregor Mar 8, 2022
69c998f
[Constraint system] Have simplifyOpenedExistentialOfConstraint use op…
DougGregor Mar 8, 2022
08e417c
Eliminate unnecessary check for opaque types.
DougGregor Mar 8, 2022
a67a62b
Merge pull request #41726 from hamishknight/xfail-dependent-types
hamishknight Mar 8, 2022
d0e377e
[utils] Use Python 2 compatible name for text=True
lorentey Mar 8, 2022
a2c7f63
[move-function-addr] Add a small comment to the checker.
gottesmm Mar 3, 2022
2af1460
[AutoDiff] Introduce regression test for SR-15849 (#41717)
philipturner Mar 8, 2022
d5f63ee
Enable Sendability for AsyncStream and AsyncThrowingStream (#41713)
phausler Mar 8, 2022
db63c21
Merge pull request #41729 from DougGregor/opened-existential-cleanups
DougGregor Mar 8, 2022
b7bdb91
AST: Allow type parameters in superclass bound in ASTContext::getOpen…
slavapestov Mar 8, 2022
21def03
Revert "AST: Temporarily remove calls to TypeBase::getMinimalCanonica…
slavapestov Mar 8, 2022
033b8bf
Merge pull request #41722 from ktoso/wip-move-anyactor
ktoso Mar 8, 2022
b292512
Parse: Add availability macro support to @_backDeploy attribute parsi…
tshortli Mar 7, 2022
486940b
Merge pull request #41731 from gottesmm/pr-3f9436cebb06906a5bfc4c8e9f…
gottesmm Mar 8, 2022
1cfffb8
[CodeSynthesis] Improve synthesized Decodable.init(from:) for enums
rintaro Mar 4, 2022
343caa5
Merge pull request #41651 from cachemeifyoucan/eng/PR-89448415
cachemeifyoucan Mar 8, 2022
e6d8912
Merge pull request #41712 from cabmeurer/cxx-interop/Fix-typo-update-…
zoecarver Mar 9, 2022
da265fe
[utils] shell.run: Stop printing the cwd to stdout before each command
lorentey Mar 9, 2022
a11b8d9
[utils] shell.run: Flush stdout/stderr after printing
lorentey Mar 9, 2022
bc6a38c
Merge pull request #41733 from slavapestov/reenable-minimal-canonical…
slavapestov Mar 9, 2022
713e0a4
RequirementMachine: Reduce replacement paths for redundant rules to l…
slavapestov Mar 1, 2022
a0c3045
RequirementMachine: Relax criterion for deleting a useless loop
slavapestov Mar 8, 2022
95f122f
RequirementMachine: Add -enable-requirement-machine-loop-normalizatio…
slavapestov Mar 8, 2022
4f9cf1d
[utils] update_checkout: During parallel execution, prefix each print…
lorentey Mar 9, 2022
b6a641b
RequirementMachine: New way of introducing concrete conformance rules
slavapestov Mar 9, 2022
cfdb937
AST: Stricter invariants in GenericSignature::verify()
slavapestov Mar 8, 2022
d73689f
[test] lit.cfg: TARGET_ENV_PREFIX ⟹ config.target_env_prefix
lorentey Mar 9, 2022
4b881cf
[test] lit.cfg: Introduce config.target_library_path_var for the corr…
lorentey Mar 9, 2022
1a31f38
[test] lit.cfg: List the contents of the remote directory after upload
lorentey Mar 9, 2022
e2f7d51
Register Parameterized Protocol Abbreviation
CodaFi Feb 28, 2022
3b3ff6a
Define Mangling for ParameterizedProtocol
CodaFi Feb 24, 2022
f7b2a8e
Pretty-Print Bound Demangled Parameterized Protocols
CodaFi Feb 28, 2022
e3119a8
Allow Retrieving Nominal Types from PPTs
CodaFi Mar 1, 2022
635d253
Unify ParameterizedProtocolTypes
CodaFi Mar 1, 2022
e2ed202
Unlock Parameterized Existentials Behind 'any'
CodaFi Mar 9, 2022
3f8e4e7
AST: Fix mistake with generic signature in findExistentialSelfReferen…
slavapestov Mar 9, 2022
4efcb82
Unlock Opaque Types in Parameterized Protocols
CodaFi Mar 9, 2022
0c529b0
Merge pull request #41714 from lorentey/fix-update-checkout-output
lorentey Mar 9, 2022
a62a5ca
SILMem2Reg: fix a problem with leaking enum values
eeckstein Mar 8, 2022
9d78186
tests: disable sil_verify_all_triggers_verifier_without_asserts.sil
eeckstein Mar 9, 2022
bfac01f
Merge pull request #41741 from lorentey/lit-cleanups
lorentey Mar 9, 2022
4beadfe
Merge pull request #41744 from eeckstein/fix-mem2reg
swift-ci Mar 9, 2022
79dcb57
Merge pull request #41745 from eeckstein/disable-test
swift-ci Mar 9, 2022
f204f06
Add a build option for the concurrency tracing feature.
al45tair Mar 9, 2022
a872ee0
[test] Disable typeref_decoding_objc.swift on arm64e
hamishknight Mar 9, 2022
05a3f1f
Merge pull request #41748 from hamishknight/disable-typeref-decoding-…
hamishknight Mar 9, 2022
6a020f8
Stabilize and simplify SIL linkage and serialization
eeckstein Mar 7, 2022
a182a70
[test] Disable a couple of DebugInfo tests
hamishknight Mar 9, 2022
cb902d5
Merge pull request #41749 from hamishknight/disable-debug-tests-harder
hamishknight Mar 9, 2022
187e6f3
[test] Disable ArrayTrapsObjC.swift for backdeployment
hamishknight Mar 9, 2022
c361a49
Merge pull request #41750 from hamishknight/disable-array-trap-backde…
hamishknight Mar 9, 2022
b71dc9c
Merge pull request #41742 from slavapestov/fix-find-existential-self-…
slavapestov Mar 9, 2022
8df83fe
Merge pull request #41614 from slavapestov/rqm-left-canonical-form
slavapestov Mar 9, 2022
3508d41
[Mem2Reg] Skip load [take] of cast projections.
nate-chandler Mar 9, 2022
f24cf9a
Enable Requirement Machine unconditionally for test/Prototypes/BigInt…
slavapestov Mar 9, 2022
322ffc3
Merge pull request #41672 from mikeash/fix-swift-inspect-watchos
mikeash Mar 9, 2022
d1b60c8
Merge pull request #41670 from mikeash/signpost-task-flags-changed
mikeash Mar 9, 2022
44a9753
Merge pull request #41703 from eeckstein/simplify-linkage
eeckstein Mar 9, 2022
b8370d6
[nfc] Use `^stdlib` not `stdlib` for lit regex filter.
zoecarver Mar 8, 2022
4ffde96
[SSADestroyHoisting] Fixed pointer handling.
nate-chandler Feb 22, 2022
c1adf24
[MemAccessUtils] Returned visitor's return.
nate-chandler Mar 3, 2022
2855198
Merge pull request #41732 from zoecarver/fix-lit-filter-stdlib
hamishknight Mar 9, 2022
8da37b0
Merge pull request #41734 from tshortli/accept-availability-macros-in…
tshortli Mar 9, 2022
0aead28
Add a Compiler Crasher
CodaFi Mar 9, 2022
c9d202e
Merge pull request #41752 from slavapestov/bigint-test
slavapestov Mar 9, 2022
b18e815
[RequirementMachine] Preserve structural requirements during rule con…
hborla Feb 26, 2022
3c95cac
[RequirementMachine] Store a requirement ID for explicit rules in the
hborla Feb 26, 2022
be30d76
[RequirementMachine] Diagnose redundant requirements found during min…
hborla Feb 28, 2022
a154641
[RequirementMachine] Propagate explicit requirement IDs from redundant
hborla Mar 2, 2022
3976849
[RequirementMachine] Suppress redundancy warnings when an explicit, r…
hborla Mar 4, 2022
2f7018b
[RequirementMachine] Don't suppress redundancy diagnostics when the
hborla Mar 8, 2022
cf05e61
Merge pull request #41723 from etcwilde/ewilde/garden-anchors
etcwilde Mar 9, 2022
5bb40ae
Sema: Fix doesMemberHaveUnfulfillableConstraintsWithExistentialBase()…
slavapestov Mar 9, 2022
fcdcb2a
[interop][SwiftToC++] print C++ interface for top-level Swift functions
hyp Jan 25, 2022
512ebc5
Merge pull request #41743 from CodaFi/existential-dread
CodaFi Mar 9, 2022
599bb79
Sema: Generalize the 'invariant Self requirement' check to handle a r…
slavapestov Mar 9, 2022
b5d7a01
[RequirementMachine] Factor the 'rules once in empty context' computa…
hborla Mar 8, 2022
4a5962f
Merge pull request #41754 from nate-chandler/mem_access_utils/unique_…
nate-chandler Mar 10, 2022
009ed74
Merge pull request #41753 from nate-chandler/lexical_lifetimes/lexica…
nate-chandler Mar 10, 2022
4343d94
Merge pull request #41751 from nate-chandler/mem2reg/bail-on-load-tak…
nate-chandler Mar 10, 2022
a6b586d
Ensure that we print @Sendable when printing TypeReprs.
DougGregor Mar 10, 2022
e05b011
[docs] NFC, fix typo CppInteropability -> CppInteroperability
hyp Mar 10, 2022
4b55c30
[RequirementMachine] Instead of recording redundant requirements and …
hborla Mar 10, 2022
1ff3fda
Merge pull request #41757 from slavapestov/protocol-self-reference-fixes
slavapestov Mar 10, 2022
79533bb
Merge pull request #41761 from hyp/fix-docs-typo
hyp Mar 10, 2022
1d3b682
[interop][SwiftToC++] fix execution tests to hopefully link correctly…
hyp Mar 10, 2022
0085eb0
[RequirementMachine] Separate setting the explicit bit and the requir…
hborla Mar 10, 2022
d2c3e46
Make toplevel vars MainActor with warn-concurrency
etcwilde Mar 9, 2022
0d87a10
Merge pull request #41746 from al45tair/eng/PR-89787540
al45tair Mar 10, 2022
231af68
[cxx-interop] Enable a test on Linux
egorzhdan Mar 10, 2022
5ab8e08
[Distributed] Reimplement distributed call thunks completely in AST (…
ktoso Mar 10, 2022
cf47090
Add testcase for fixed circular reference issue: rdar://89921930
slavapestov Mar 10, 2022
846fdb5
[interop] add target-build-swift-link-cxx option for windows to link …
hyp Mar 10, 2022
07a1f56
[interop] add target-interop-clangxx test expansion to build C++ file…
hyp Mar 10, 2022
9e919fd
Merge pull request #41765 from apple/egorzhdan/cxx-test-linux
egorzhdan Mar 10, 2022
1466afc
Ensure that emit unnamed isolated parameters
DougGregor Mar 10, 2022
ebcf2f7
[interop] fixup the interop build test substitutions
hyp Mar 10, 2022
09cdd36
[c++-interop] For failed imports in ClangImporter, cache them regardl…
plotfi Mar 10, 2022
323238f
Merge pull request #41760 from DougGregor/print-sendable-typereprs
DougGregor Mar 10, 2022
7ce6504
[RequirementMachine] Avoid passing the requirement error vector through
hborla Mar 10, 2022
f014e9f
Merge pull request #41766 from slavapestov/test-rdar89921930.swift
slavapestov Mar 10, 2022
3b97bd5
[Distributed] NFC: Allow 64-bit distributed test only on x86_64 and a…
xedin Mar 11, 2022
5f42dd5
Merge pull request #41775 from xedin/disable-64-bit-test-on-32bit-sim…
kavon Mar 11, 2022
58f0a1c
[Distributed] Disable some tests on optimized builds until we fix
ktoso Mar 11, 2022
d42593a
[Distributed] better diagnostics for missing actor system typealias
ktoso Mar 1, 2022
25370d2
Merge pull request #41776 from ktoso/wip-disable-opt
kavon Mar 11, 2022
ea89407
Extend the lifetime of the buffer while copying from a _CocoaArrayWra…
DougGregor Mar 11, 2022
f2d60e1
[Distributed] add note explaining DefaultDistributedActorSystem
ktoso Mar 11, 2022
a024e8f
Merge pull request #41602 from ktoso/wip-better-error
swift-ci Mar 11, 2022
459fb37
Merge pull request #41768 from DougGregor/emit-unnamed-isolated-params
DougGregor Mar 11, 2022
07bb2b1
Merge pull request #41779 from DougGregor/extend-cocoaarray-buffer
DougGregor Mar 11, 2022
b243d64
[Distributed] IRGen: Don't emit accessor for distributed thunk specia…
xedin Mar 11, 2022
d3702ba
Merge pull request #41664 from hborla/redundant-requirements
hborla Mar 11, 2022
6d502fc
[Distributed] Implicit Codable conformance for Dist Actors
ktoso Mar 8, 2022
b86bb0d
fix require-explicit-sendable
ktoso Mar 11, 2022
fab0463
adjust test since other features were merged since
ktoso Mar 11, 2022
59b9794
Merge pull request #41727 from ktoso/wip-implicit-codable
swift-ci Mar 11, 2022
ee7b941
Merge pull request #41783 from xedin/rdar-90129442
ktoso Mar 11, 2022
13cc8b3
[Distributed] Enable no-longer-experimental distributed by default
ktoso Mar 10, 2022
d57cf85
[Changelog] add Distributed Actors
ktoso Mar 11, 2022
b92874c
[Distributed] fix source completion test; it suggests distributed too…
ktoso Mar 11, 2022
d17329d
[DEBUG] try debugging the issue on CI
ktoso Mar 11, 2022
00bf405
[Distributed] disable elf test, need to debug on a linux host
ktoso Mar 11, 2022
05e643b
[DI] Fixup alloc_box borrow scope ends.
nate-chandler Mar 11, 2022
c979b9f
Merge pull request #41763 from etcwilde/ewilde/warn-concurrency-async…
DougGregor Mar 11, 2022
ca25261
Merge pull request #41710 from compnerd/intrinsics
compnerd Mar 11, 2022
5fb34b4
Merge pull request #40995 from hyp/function-to-cxx-thunk
hyp Mar 11, 2022
bd6f27b
Stop mapping opened archetypes "out of context".
DougGregor Mar 11, 2022
30a7ec1
Merge pull request #41674 from rintaro/sema-codablesynth-rdar89150202
rintaro Mar 11, 2022
c6cb3cc
[Distributed] NFC: Fix incorrect RUN: command in two test-cases
xedin Mar 11, 2022
c1e326c
SILGen: Fix SILGen for accessor functions with `@_backDeploy`. Previo…
tshortli Mar 11, 2022
b962b6f
Merge pull request #41786 from DougGregor/opened-archetypes-back-in-y…
DougGregor Mar 11, 2022
58b414d
Merge pull request #41781 from nate-chandler/lexical_lifetimes/di-mov…
nate-chandler Mar 11, 2022
94de12b
Merge pull request #41788 from tshortli/back-deploy-accessors
swift-ci Mar 11, 2022
abc8aa6
Merge pull request #41780 from ktoso/wip-just-flag-dist
xedin Mar 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,36 @@ _**Note:** This is in reverse chronological order, so newer entries are added to

## Swift 5.7

* [SE-0336][]:

It is now possible to declare `distributed actor` and `distributed func`s inside of them.

Distributed actors provide stronger isolation guarantees than "local" actors, and enable additional checks to be made on return types and parameters of distributed methods, e.g. checking if they conform to `Codable`. Distributed methods can be called on "remote" references of distributed actors, turning those invocations into remote procedure calls, by means of pluggable and user extensible distributed actor system implementations.

Swift does not provide any specific distributed actor system by itself, however, packages in the ecosystem fulfil the role of providing those implementations.

```swift
distributed actor Greeter {
var greetingsSent = 0

distributed func greet(name: String) -> String {
greetingsSent += 1
return "Hello, \(name)!"
}
}

func talkTo(greeter: Greeter) async throws {
// isolation of distributed actors is stronger, it is impossible to refer to
// any stored properties of distributed actors from outside of them:
greeter.greetingsSent // distributed actor-isolated property 'name' can not be accessed from a non-isolated context

// remote calls are implicitly throwing and async,
// to account for the potential networking involved:
let greeting = try await greeter.greet(name: "Alice")
print(greeting) // Hello, Alice!
}
```

* The compiler now emits a warning when a non-final class conforms to a protocol that imposes a same-type requirement between `Self` and an associated type. This is because such a requirement makes the conformance unsound for subclasses.

For example, Swift 5.6 would allow the following code, which at runtime would construct an instanec of `C` and not `SubC` as expected:
Expand Down Expand Up @@ -9034,6 +9064,7 @@ Swift 1.0
[SE-0337]: <https://github.com/apple/swift-evolution/blob/main/proposals/0337-support-incremental-migration-to-concurrency-checking.md>
[SE-0335]: <https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md>
[SE-0341]: <https://github.com/apple/swift-evolution/blob/main/proposals/0341-opaque-parameters.md>
[SE-0336]: <https://github.com/apple/swift-evolution/blob/main/proposals/0336-distributed-actor-isolation.md>

[SR-75]: <https://bugs.swift.org/browse/SR-75>
[SR-106]: <https://bugs.swift.org/browse/SR-106>
Expand Down
1 change: 1 addition & 0 deletions docs/ABI/Mangling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ Types
type ::= protocol-list 'p' // existential type
type ::= protocol-list superclass 'Xc' // existential type with superclass
type ::= protocol-list 'Xl' // existential type with AnyObject
type ::= protocol-list 'y' (type* '_')* type* retroactive-conformance* 'Xp' // parameterized protocol type
type ::= type-list 't' // tuple
type ::= type generic-signature 'u' // generic type
type ::= 'x' // generic param, depth=0, idx=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,24 +59,23 @@ struct ContentView: View {
```

```
//In Cxx.cpp
//In Cxx.hpp

#ifndef Cxx_hpp
#define Cxx_hpp

#include "Cxx.hpp"
int cxxFunction(int n) {
return n;
}

#endif
```

```
//In Cxx.hpp

#ifndef Cxx_hpp
#define Cxx_hpp
//In Cxx.cpp

#include "Cxx.hpp"
int cxxFunction(int n);

#endif

```

Expand Down Expand Up @@ -198,7 +197,7 @@ CxxInterop.main()

```

- In your projects direcetoy, run `cmake` to generate the systems build files
- In your project's directory, run `cmake` to generate the systems build files

- To generate an Xcode project run `cmake -GXcode`
- To generate with Ninja run `cmake -GNinja`
Expand Down
10 changes: 10 additions & 0 deletions docs/ReferenceGuides/UnderscoredAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,20 @@ the compiler.

This `async` function uses the pre-SE-0338 semantics of unsafely inheriting the caller's executor. This is an underscored feature because the right way of inheriting an executor is to pass in the required executor and switch to it. Unfortunately, there are functions in the standard library which need to inherit their caller's executor but cannot change their ABI because they were not defined as `@_alwaysEmitIntoClient` in the initial release.


## `@_spi_available(platform, version)`

Like `@available`, this attribute indicates a decl is available only as an SPI.
This implies several behavioral changes comparing to regular `@available`:
1. Type checker diagnoses when a client accidently exposes such a symbol in library APIs.
2. When emitting public interfaces, `@_spi_available` is printed as `@available(platform, unavailable)`.
3. ClangImporter imports ObjC macros `SPI_AVAILABLE` and `__SPI_AVAILABLE` to this attribute.


## `_local`

A distributed actor can be marked as "known to be local" which allows avoiding
the distributed actor isolation checks. This is used for things like `whenLocal`
where the actor passed to the closure is known-to-be-local, and similarly a
`self` of obtained from an _isolated_ function inside a distributed actor is
also guaranteed to be local by construction.
9 changes: 4 additions & 5 deletions include/swift/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,11 @@ class ASTContext final {

/// Retrieve the declaration of DistributedActorSystem.make().
///
/// \param actorOrSystem distributed actor or actor system to get the
/// remoteCall function for. Since the method we're looking for is an ad-hoc
/// requirement, a specific type MUST be passed here as it is not possible
/// to obtain the decl from just the `DistributedActorSystem` protocol type.
/// \param thunk the function from which we'll be invoking things on the obtained
/// actor system; This way we'll always get the right type, taking care of any
/// where clauses etc.
FuncDecl *getMakeInvocationEncoderOnDistributedActorSystem(
NominalTypeDecl *actorOrSystem) const;
AbstractFunctionDecl *thunk) const;

// Retrieve the declaration of
// DistributedInvocationEncoder.recordGenericSubstitution(_:).
Expand Down
2 changes: 2 additions & 0 deletions include/swift/AST/ASTDemangler.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class ASTBuilder {
bool isClassBound,
bool forRequirement = true);

Type createParameterizedProtocolType(Type base, ArrayRef<Type> args);

Type createExistentialMetatypeType(Type instance,
Optional<Demangle::ImplMetatypeRepresentation> repr=None);

Expand Down
8 changes: 8 additions & 0 deletions include/swift/AST/Attr.def
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ TYPE_ATTR(async)
TYPE_ATTR(Sendable)
TYPE_ATTR(unchecked)
TYPE_ATTR(_typeSequence)
TYPE_ATTR(_local)

// SIL-specific attributes
TYPE_ATTR(block_storage)
Expand Down Expand Up @@ -720,6 +721,13 @@ DECL_ATTR(_backDeploy, BackDeploy,
ABIStableToAdd | ABIStableToRemove | APIStableToAdd | APIBreakingToRemove,
129)

CONTEXTUAL_SIMPLE_DECL_ATTR(_local, KnownToBeLocal,
DeclModifier | OnFunc | OnParam | OnVar |
DistributedOnly |
ABIBreakingToAdd | ABIBreakingToRemove |
APIBreakingToAdd | APIBreakingToRemove,
130)

// If you're adding a new underscored attribute here, please document it in
// docs/ReferenceGuides/UnderscoredAttributes.md.

Expand Down
31 changes: 24 additions & 7 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2693,8 +2693,7 @@ class ValueDecl : public Decl {
/// property, or the uncurried result type of a method/subscript, e.g.
/// '() -> () -> Self'.
GenericParameterReferenceInfo findExistentialSelfReferences(
Type baseTy, const DeclContext *useDC,
bool treatNonResultCovariantSelfAsInvariant) const;
Type baseTy, bool treatNonResultCovariantSelfAsInvariant) const;
};

/// This is a common base class for declarations which declare a type.
Expand Down Expand Up @@ -4491,10 +4490,6 @@ class ProtocolDecl final : public NominalTypeDecl {
/// semantics but has no corresponding witness table.
bool isMarkerProtocol() const;

/// Is a protocol that can only be conformed by distributed actors.
/// Such protocols are allowed to contain distributed functions.
bool inheritsFromDistributedActor() const;

private:
void computeKnownProtocolKind() const;

Expand Down Expand Up @@ -5255,6 +5250,10 @@ class VarDecl : public AbstractStorageDecl {
/// Does this have a 'distributed' modifier?
bool isDistributed() const;

/// Is this var known to be a "local" distributed actor,
/// if so the implicit throwing ans some isolation checks can be skipped.
bool isKnownToBeLocal() const;

/// Is this a stored property that will _not_ trigger any user-defined code
/// upon any kind of access?
bool isOrdinaryStoredProperty() const;
Expand Down Expand Up @@ -6309,7 +6308,15 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
/// Returns 'true' if the function is distributed.
bool isDistributed() const;

/// Returns 'true' if the function has the @c @_backDeploy attribute.
/// For a 'distributed' target (func or computed property),
/// get the 'thunk' responsible for performing the 'remoteCall'.
///
/// \return the synthesized thunk, or null if the base of the call has
/// diagnosed errors during type checking.
FuncDecl *getDistributedThunk() const;

/// Returns 'true' if the function has (or inherits) the @c @_backDeploy
/// attribute.
bool isBackDeployed() const;

PolymorphicEffectKind getPolymorphicEffectKind(EffectKind kind) const;
Expand Down Expand Up @@ -6456,6 +6463,16 @@ class AbstractFunctionDecl : public GenericContext, public ValueDecl {
/// 'DistributedActorSystem' protocol.
bool isDistributedActorSystemRemoteCall(bool isVoidReturn) const;

/// Determines whether this function is a 'makeInvocationEncoder' function,
/// which is used as ad-hoc protocol requirement by the
/// 'DistributedActorSystem' protocol.
bool isDistributedActorSystemMakeInvocationEncoder() const;

/// Determines if this function is a 'recordGenericSubstitution' function,
/// which is used as ad-hoc protocol requirement by the
/// 'DistributedTargetInvocationEncoder' protocol.
bool isDistributedTargetInvocationEncoderRecordGenericSubstitution() const;

/// Determines if this function is a 'recordArgument' function,
/// which is used as ad-hoc protocol requirement by the
/// 'DistributedTargetInvocationEncoder' protocol.
Expand Down
35 changes: 0 additions & 35 deletions include/swift/AST/DiagnosticsParse.def
Original file line number Diff line number Diff line change
Expand Up @@ -1561,46 +1561,16 @@ ERROR(attr_availability_duplicate,none,
(StringRef, StringRef))

// originallyDefinedIn
// FIXME(backDeploy): Refactor to share with back deployment attr
ERROR(originally_defined_in_missing_rparen,none,
"expected ')' in @_originallyDefinedIn argument list", ())

// FIXME(backDeploy): Refactor to share with back deployment attr
ERROR(originally_defined_in_unrecognized_platform,none,
"unrecognized platform name in @_originallyDefinedIn argument list", ())

// FIXME: This is unused and can be removed
ERROR(originally_defined_in_unrecognized_property,none,
"unrecognized property in @_originallyDefinedIn argument list", ())

ERROR(originally_defined_in_need_original_module_name,none,
"expected 'module: \"original\"' in the first argument to "
"@_originallyDefinedIn", ())

ERROR(originally_defined_in_need_nonempty_module_name,none,
"original module name cannot be empty in @_originallyDefinedIn", ())

// FIXME(backDeploy): Refactor to share with back deployment attr
ERROR(originally_defined_in_need_platform_version,none,
"expected at least one platform version in @_originallyDefinedIn", ())

// FIXME(backDeploy): Refactor to share with back deployment attr
WARNING(originally_defined_in_major_minor_only,none,
"@_originallyDefinedIn only uses major and minor version number", ())

// FIXME(backDeploy): Refactor to share with back deployment attr
WARNING(originally_defined_in_missing_platform_name,none,
"* as platform name has no effect", ())

// FIXME(backDeploy): Refactor to share with back deployment attr
WARNING(originally_defined_in_swift_version, none,
"Swift language version checks has no effect "
"in @_originallyDefinedIn", ())

WARNING(originally_defined_in_package_description, none,
"PackageDescription version checks has no effect "
"in @_originallyDefinedIn", ())

// backDeploy
ERROR(attr_back_deploy_missing_rparen,none,
"expected ')' in '@_backDeploy' argument list", ())
Expand Down Expand Up @@ -1917,11 +1887,6 @@ ERROR(attr_requires_concurrency, none,
"concurrency is enabled",
(StringRef, bool))

ERROR(attr_requires_distributed, none,
"'%0' %select{attribute|modifier}1 is only valid when experimental "
"distributed support is enabled",
(StringRef, bool))

//------------------------------------------------------------------------------
// MARK: syntax parsing diagnostics
//------------------------------------------------------------------------------
Expand Down
18 changes: 16 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -1935,8 +1935,8 @@ WARNING(type_does_not_conform_swiftui_warning,none,

ERROR(non_final_class_cannot_conform_to_self_same_type,none,
"non-final class %0 cannot safely conform to protocol %1, "
"which requires that 'Self' is exactly equal to %2",
(Type, Type, Type))
"which requires that %2 %select{is exactly equal to|inherit from}3 %4",
(Type, Type, Type, unsigned, Type))

ERROR(cannot_use_nil_with_this_type,none,
"'nil' cannot be used in context expecting type %0", (Type))
Expand Down Expand Up @@ -4495,6 +4495,13 @@ ERROR(actor_inheritance,none,
ERROR(actor_protocol_illegal_inheritance,none,
"non-actor type %0 cannot conform to the 'Actor' protocol",
(DeclName))
ERROR(distributed_actor_conformance_missing_system_type,none,
"distributed actor %0 does not declare ActorSystem it can be used with.",
(DeclName))
NOTE(note_distributed_actor_system_can_be_defined_using_defaultdistributedactorsystem,none,
"you can provide a module-wide default actor system by declaring:\n"
"typealias DefaultDistributedActorSystem = <#ConcreteActorSystem#>\n",
())
ERROR(distributed_actor_protocol_illegal_inheritance,none,
"non-distributed actor type %0 cannot conform to the 'DistributedActor' protocol",
(DeclName))
Expand Down Expand Up @@ -4595,6 +4602,9 @@ NOTE(note_distributed_actor_isolated_method,none,
ERROR(distributed_actor_isolated_method,none,
"only 'distributed' instance methods can be called on a potentially remote distributed actor",
())
ERROR(distributed_local_cannot_be_used,none,
"'local' cannot be used in user-defined code currently",
())
ERROR(distributed_actor_func_param_not_codable,none,
"parameter '%0' of type %1 in %2 does not conform to serialization requirement '%3'",
(StringRef, Type, DescriptiveDeclKind, StringRef))
Expand Down Expand Up @@ -6310,5 +6320,9 @@ ERROR(attr_incompatible_with_back_deploy,none,
"'%0' cannot be applied to a back deployed %1",
(DeclAttribute, DescriptiveDeclKind))

ERROR(back_deploy_not_on_coroutine,none,
"'%0' is not supported on coroutine %1",
(DeclAttribute, DescriptiveDeclKind))

#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
23 changes: 16 additions & 7 deletions include/swift/AST/DistributedDecl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ class DeclContext;
class FuncDecl;
class NominalTypeDecl;

/// Determine the concrete type of 'ActorSystem' as seen from the member.
/// E.g. when in a protocol, and trying to determine what the actor system was
/// constrained to.
///
/// \param member the member from which context the lookup should be performed,
/// e.g. a function or computed property.
/// \return the concrete type of the ActorSystem to be used by this member,
/// or null if no concrete actor system was found.
Type getConcreteReplacementForProtocolActorSystemType(ValueDecl *member);

/// Determine the `ActorSystem` type for the given actor.
Type getDistributedActorSystemType(NominalTypeDecl *actor);

Expand All @@ -43,14 +53,12 @@ Type getDistributedActorIDType(NominalTypeDecl *actor);
Type getDistributedSerializationRequirementType(
NominalTypeDecl *nominal, ProtocolDecl *protocol);

///// Determine the serialization requirement for the given actor, actor system
///// or other type that has the SerializationRequirement associated type.
//Type getDistributedSerializationRequirementType(
// NominalTypeDecl *nominal, ProtocolDecl *protocol);

Type getDistributedActorSystemActorIDRequirementType(
NominalTypeDecl *system);
/// Get the specific 'InvocationEncoder' type of a specific distributed actor
/// system.
Type getDistributedActorSystemInvocationEncoderType(NominalTypeDecl *system);

/// Get the 'ActorID' type of a specific distributed actor system.
Type getDistributedActorSystemActorIDRequirementType(NominalTypeDecl *system);

/// Get the specific protocols that the `SerializationRequirement` specifies,
/// and all parameters / return types of distributed targets must conform to.
Expand Down Expand Up @@ -98,6 +106,7 @@ getDistributedSerializationRequirements(
llvm::SmallPtrSet<ProtocolDecl *, 2>
extractDistributedSerializationRequirements(
ASTContext &C, ArrayRef<Requirement> allRequirements);

}

#endif /* SWIFT_DECL_TYPECHECKDISTRIBUTED_H */
Loading