Skip to content

Commit 9f1fedb

Browse files
committed
WIP serialization, many files etc
1 parent bc8657b commit 9f1fedb

File tree

8 files changed

+479
-13
lines changed

8 files changed

+479
-13
lines changed

lib/Sema/DerivedConformanceDistributedActor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ static ValueDecl *deriveDistributedActor_actorTransport(
160160

161161
ValueDecl *DerivedConformance::deriveDistributedActor(ValueDecl *requirement) {
162162
if (auto var = dyn_cast<VarDecl>(requirement)) {
163+
fprintf(stderr, "[%s:%d] (%s) DERIVE: [%s]\n", __FILE__, __LINE__, __FUNCTION__, var->getName().str().str().c_str());
164+
163165
if (var->getName() == Context.Id_id)
164166
return deriveDistributedActor_id(*this);
165167

@@ -168,6 +170,8 @@ ValueDecl *DerivedConformance::deriveDistributedActor(ValueDecl *requirement) {
168170
}
169171

170172
if (auto func = dyn_cast<FuncDecl>(requirement)) {
173+
fprintf(stderr, "[%s:%d] (%s) DERIVE: [%s]\n", __FILE__, __LINE__, __FUNCTION__, func->getName().getBaseIdentifier().str().str().c_str());
174+
171175
// just a simple name check is enough here,
172176
// if we are invoked here we know for sure it is for the "right" function
173177
if (func->getName().getBaseName() == Context.Id_resolve)

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,9 +2930,19 @@ class DeclChecker : public DeclVisitor<DeclChecker> {
29302930

29312931
TypeChecker::checkDeclAttributes(ED);
29322932

2933+
fprintf(stderr, "[%s:%d] (%s) VISIT EXTENSION\n", __FILE__, __LINE__, __FUNCTION__);
29332934
if (nominal->isDistributedActor()) {
29342935
auto decl = dyn_cast<ClassDecl>(nominal);
29352936
TypeChecker::checkDistributedActor(decl);
2937+
2938+
fprintf(stderr, "[%s:%d] (%s) VISIT DIST ACTOR MEMBERS FROM EXTENSION\n", __FILE__, __LINE__, __FUNCTION__);
2939+
for (Decl *Member : ED->getMembers()) {
2940+
if (auto var = dyn_cast<VarDecl>(Member))
2941+
fprintf(stderr, "[%s:%d] (%s) VISIT MEMBER: [%s]\n", __FILE__, __LINE__, __FUNCTION__, var->getName().str().str().c_str());
2942+
if (auto func = dyn_cast<FuncDecl>(Member))
2943+
fprintf(stderr, "[%s:%d] (%s) VISIT MEMBER: [%s]\n", __FILE__, __LINE__, __FUNCTION__, func->getName().getBaseName().getIdentifier().str().str().c_str());
2944+
}
2945+
29362946
}
29372947

29382948
for (Decl *Member : ED->getMembers())

lib/Sema/TypeCheckDistributed.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void swift::checkDistributedActorConstructor(const ClassDecl *decl, ConstructorD
215215
// ==== ------------------------------------------------------------------------
216216

217217
void TypeChecker::checkDistributedActor(ClassDecl *decl) {
218+
fprintf(stderr, "[%s:%d] (%s) CHECK DIST [%s]\n", __FILE__, __LINE__, __FUNCTION__, decl->getNameStr().str().c_str());
218219
if (!decl)
219220
return;
220221

stdlib/public/Distributed/DistributedActor.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import _Concurrency
2020
///
2121
/// FIXME(distributed): We'd need Actor to also conform to this, but don't want to add that conformance in _Concurrency yet.
2222
@_marker
23+
@available(SwiftStdlib 5.5, *)
2324
public protocol AnyActor: Sendable, AnyObject {}
2425

2526
// ==== Distributed Actor -----------------------------------------------------
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import _Distributed
22

3-
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
4-
distributed actor DA {
5-
public distributed func doSomethingDistributed() async -> Int {
6-
return 0
7-
}
3+
@available(SwiftStdlib 5.5, *)
4+
public distributed actor DA {
5+
public distributed func doSomethingDistributed(param: String) async -> Int {
6+
return 0
7+
}
88
}

test/Serialization/distributed.swift

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %empty-directory(%t-scratch)
3-
// RUN: %target-swift-frontend -emit-module -o %t-scratch/def_async~partial.swiftmodule -primary-file %S/Inputs/def_distributed.swift -module-name def_async -enable-experimental-distributed
4-
// RUN: %target-swift-frontend -merge-modules -emit-module -parse-as-library -enable-testing %t-scratch/def_distributed~partial.swiftmodule -module-name def_async -o %t/def_async.swiftmodule -enable-experimental-distributed
5-
// RUN: %target-swift-frontend -typecheck -I%t -verify %s -verify-ignore-unknown -enable-experimental-distributed
3+
// RUN: echo "---- STEP 1 ---------------------------------------------------"
4+
// RUN: %target-swift-frontend -emit-module -o %t-scratch/def_distributed~partial.swiftmodule -primary-file %S/Inputs/def_distributed.swift -module-name def_distributed -disable-availability-checking -enable-experimental-distributed
5+
// RUN: echo "---- STEP 2 ---------------------------------------------------"
6+
// RUN: %target-swift-frontend -merge-modules -emit-module -parse-as-library -enable-testing %t-scratch/def_distributed~partial.swiftmodule -module-name def_distributed -o %t/def_distributed.swiftmodule -disable-availability-checking -enable-experimental-distributed
7+
// RUN: echo "---- STEP 3 ---------------------------------------------------"
8+
// RUN: %target-swift-frontend -typecheck -I%t -verify %s -verify-ignore-unknown -disable-availability-checking -enable-experimental-distributed
69

710
// REQUIRES: concurrency
811
// REQUIRES: distributed
912

10-
// TODO: fix this test, not sure what the issue is hm
11-
// XFAIL: *
12-
13+
import _Distributed
1314
import def_distributed
1415

15-
func testDoSomethingDistributed() {
16-
// TODO: do the test
16+
func testDoSomethingDistributed(transport: ActorTransport) {
17+
let da = DA(transport: transport)
18+
}
19+
20+
extension DA {
21+
@_dynamicReplacement(for:_remote_doSomethingDistributed(param:))
22+
func _impl_doSomethingDistributed(param: String) async throws -> Int {
23+
return 2222
24+
}
1725
}

0 commit comments

Comments
 (0)