File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-experimental-concurrency
2
+
3
+ var intAsyncProp : Int {
4
+ get async { 0 }
5
+ }
6
+
7
+ var intThrowsProp : Int { // expected-note 2 {{var declared here}}
8
+ get throws { 0 }
9
+ }
10
+
11
+ var asyncThrowsProp : Int {
12
+ // expected-warning@+1 {{reference to var 'intThrowsProp' is not concurrency-safe because it involves shared mutable state}}
13
+ get async throws { try await intAsyncProp + intThrowsProp }
14
+ }
15
+
16
+ func hello( ) async {
17
+ // expected-warning@+1 {{reference to var 'intThrowsProp' is not concurrency-safe because it involves shared mutable state}}
18
+ _ = intThrowsProp // expected-error{{property access can throw, but it is not marked with 'try' and the error is not handled}}
19
+
20
+ _ = intAsyncProp // expected-error{{property access is 'async' but is not marked with 'await'}}
21
+ }
22
+
23
+ class C {
24
+ var counter : Int = 0
25
+ }
26
+
27
+ var refTypeThrowsProp : C { // expected-note {{var declared here}}
28
+ get throws { return C ( ) }
29
+ }
30
+
31
+ var refTypeAsyncProp : C {
32
+ get async { return C ( ) }
33
+ }
34
+
35
+ func salam( ) async {
36
+ // expected-warning@+1 {{reference to var 'refTypeThrowsProp' is not concurrency-safe because it involves shared mutable state}}
37
+ _ = refTypeThrowsProp // expected-error{{property access can throw, but it is not marked with 'try' and the error is not handled}}
38
+
39
+
40
+ _ = refTypeAsyncProp // expected-error {{property access is 'async' but is not marked with 'await'}}
41
+ }
You can’t perform that action at this time.
0 commit comments