1+ // RUN: %target-typecheck-verify-swift
2+ // now check that the fix-its, if applied, will fix the warnings.
3+ // RUN: %empty-directory(%t.scratch)
4+ // RUN: cp %s %t.scratch/fixits.swift
5+ // RUN: %target-swift-frontend -typecheck %t.scratch/fixits.swift -fixit-all -emit-fixits-path %t.scratch/fixits.remap 2> /dev/null
6+ // RUN: %{python} %utils/apply-fixit-edits.py %t.scratch
7+ // RUN: %target-swift-frontend -typecheck %t.scratch/fixits.swift -warnings-as-errors
8+ // RUN: %target-swift-frontend -typecheck %t.scratch/fixits.swift -warnings-as-errors -enable-experimental-concurrency
9+
10+ // REQUIRES: concurrency
11+
12+ func await( _ f : ( ) -> Void ) { }
13+
14+ func ordinaryCalls( ) {
15+ await ( { } )
16+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
17+
18+ await { }
19+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
20+
21+ let _ = `await`
22+ let _ = `await` ( { } )
23+
24+ let _ = await
25+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
26+
27+ let k = Klass ( )
28+ k. await ( )
29+ _ = k. await
30+ }
31+
32+ func localVar( ) {
33+ var await = 1
34+
35+ let two = await + await
36+ // expected-warning@-1 2 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
37+
38+ _ = await == two- await
39+ // expected-warning@-1 2 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
40+
41+ takesInout ( await : & await )
42+ }
43+
44+ func takesUnitFunc( _ f : ( ) -> Void ) { }
45+
46+ func takesInout( await : inout Int ) {
47+ await += 1
48+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
49+ }
50+
51+ class Klass {
52+ init ( ) { await ( ) }
53+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
54+
55+ func await( ) {
56+
57+ takesUnitFunc ( await )
58+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
59+ }
60+
61+ func method( ) {
62+ let _ = self . await
63+ self . await ( )
64+
65+ await ( )
66+ // expected-warning@-1 {{future versions of Swift reserve the word 'await'; if this name is unavoidable, use backticks to escape it}}
67+ }
68+ }
0 commit comments