Skip to content

Commit 75c5133

Browse files
committed
[Distributed] Add test case covering #58663 explicitly
1 parent 17ac2fb commit 75c5133

File tree

4 files changed

+13
-31
lines changed

4 files changed

+13
-31
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3001,11 +3001,6 @@ void swift::checkTopLevelActorIsolation(TopLevelCodeDecl *decl) {
30013001
}
30023002

30033003
void swift::checkFunctionActorIsolation(AbstractFunctionDecl *decl) {
3004-
if (decl->hasName()) {
3005-
fprintf(stderr, "[%s:%d] (%s) HERE\n", __FILE__, __LINE__, __FUNCTION__);
3006-
decl->getDeclContext()->dumpContext();
3007-
}
3008-
30093004
// Disable this check for @LLDBDebuggerFunction functions.
30103005
if (decl->getAttrs().hasAttribute<LLDBDebuggerFunctionAttr>())
30113006
return;

lib/Sema/TypeCheckDeclPrimary.cpp

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3391,29 +3391,4 @@ void TypeChecker::checkParameterList(ParameterList *params,
33913391
// Check for duplicate parameter names.
33923392
diagnoseDuplicateDecls(*params);
33933393
}
3394-
3395-
// if (auto proto = dyn_cast<ProtocolDecl>(owner->getParent())) {
3396-
// fprintf(stderr, "[%s:%d] (%s) IS PROTO: %s\n", __FILE__, __LINE__, __FUNCTION__, proto->getNameStr().str().c_str());
3397-
// proto->dump();
3398-
// auto p = owner->getASTContext().getProtocol(KnownProtocolKind::DistributedActor);
3399-
//
3400-
// for (auto member : proto->getMembers()) {
3401-
// auto func = dyn_cast<AbstractFunctionDecl>(member);
3402-
// if (!func)
3403-
// continue;
3404-
// if (!func->isDistributed())
3405-
// continue;
3406-
// auto serializationRequirementTy = getConcreteReplacementForProtocolActorSystemType(func);
3407-
//
3408-
// if (serializationRequirementTy) {
3409-
// checkDistributedFunction(func)
3410-
// }
3411-
// }
3412-
//
3413-
// if (auto x = getDistributedSerializationRequirementType(proto, p)) {
3414-
// fprintf(stderr, "[%s:%d] (%s) REQS: %p\n", __FILE__, __LINE__,
3415-
// __FUNCTION__, x);
3416-
// x.dump();
3417-
// }
3418-
// }
34193394
}

test/Distributed/distributed_actor_system_missing.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ distributed actor DA {
1818
// Note to add the typealias is diagnosed on the protocol:
1919
// _Distributed.DistributedActor:3:20: note: diagnostic produced elsewhere: protocol requires nested type 'ActorSystem'; do you want to add it?
2020
}
21+
22+
23+
// When an actor declares a typealias for a system, but that system does not exist,
24+
// we need to fail gracefully, rather than crash trying to use the non-existing type.
25+
//
26+
// Test case for: https://github.com/apple/swift/issues/58663
27+
distributed actor Server { // expected-error 2 {{distributed actor 'Server' does not declare ActorSystem it can be used with.}}
28+
// expected-note@-1{{you can provide a module-wide default actor system by declaring:}}
29+
typealias ActorSystem = DoesNotExistDataSystem
30+
// expected-error@-1{{cannot find type 'DoesNotExistDataSystem' in scope}}
31+
typealias SerializationRequirement = any Codable
32+
distributed func send() { }
33+
}

test/Distributed/distributed_protocols_distributed_func_serialization_requirements.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ distributed actor ProtocolWithChecksSeqReqDA: ProtocolWithChecksSeqReq {
6666
distributed func testAT() async throws -> NotCodable { .init() }
6767
}
6868

69-
7069
extension NoSerializationRequirementYet {
7170
// Still OK, we don't know if this will be implementable or not
7271
distributed func test2() -> NotCodable {

0 commit comments

Comments
 (0)