Skip to content

Commit 344f91a

Browse files
committed
[Distributed] dont crash when concrete system is invalid/missing type
1 parent ffba38d commit 344f91a

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN: %target-swift-frontend -typecheck -verify -enable-experimental-distributed -disable-availability-checking -I %t 2>&1 %s
2+
3+
// UNSUPPORTED: back_deploy_concurrency
4+
// REQUIRES: concurrency
5+
// REQUIRES: distributed
6+
7+
import Distributed
8+
9+
// This system does not exist: but we should not crash, but just diagnose about it:
10+
typealias DefaultDistributedActorSystem = ClusterSystem // expected-error{{cannot find type 'ClusterSystem' in scope}}
11+
12+
distributed actor MyActor {
13+
// expected-error@-1{{distributed actor 'MyActor' does not declare ActorSystem it can be used with}}
14+
// expected-note@-2{{you can provide a module-wide default actor system by declaring:}}
15+
// expected-error@-3{{type 'MyActor' does not conform to protocol 'DistributedActor'}}
16+
17+
distributed var foo: String {
18+
return "xyz"
19+
}
20+
}
21+
22+
distributed actor BadSystemActor {
23+
// expected-error@-1{{distributed actor 'BadSystemActor' does not declare ActorSystem it can be used with}}
24+
// expected-note@-2{{you can provide a module-wide default actor system by declaring:}}
25+
// expected-error@-3{{type 'BadSystemActor' does not conform to protocol 'DistributedActor'}}
26+
27+
// This system does not exist: but we should not crash, but just diagnose about it:
28+
typealias ActorSystem = ClusterSystem // expected-error{{cannot find type 'ClusterSystem' in scope}}
29+
}

0 commit comments

Comments
 (0)