File tree Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Expand file tree Collapse file tree 3 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ func myAsync() async -> Int { 0 }
2
+ func myFoo() -> Int { 0 }
3
+
4
+ func testExtract() async -> Int {
5
+ let new_name = myFoo()
6
+ let a = new_name
7
+ let b = new_name
8
+ let x = await myAsync()
9
+ let y = await myAsync()
10
+ return a + b + x + y
11
+ }
12
+
13
+ // rdar://72199992
Original file line number Diff line number Diff line change
1
+ func myAsync() async -> Int { 0 }
2
+ func myFoo() -> Int { 0 }
3
+
4
+ func testExtract() async -> Int {
5
+ let a = myFoo()
6
+ let b = myFoo()
7
+ let new_name = await myAsync()
8
+ let x = new_name
9
+ let y = new_name
10
+ return a + b + x + y
11
+ }
12
+
13
+ // rdar://72199992
Original file line number Diff line number Diff line change
1
+ func myAsync( ) async -> Int { 0 }
2
+ func myFoo( ) -> Int { 0 }
3
+
4
+ func testExtract( ) async -> Int {
5
+ let a = myFoo ( )
6
+ let b = myFoo ( )
7
+ let x = await myAsync ( )
8
+ let y = await myAsync ( )
9
+ return a + b + x + y
10
+ }
11
+
12
+ // rdar://72199992
13
+ // RUN: %empty-directory(%t.result)
14
+ // RUN: %refactor -extract-repeat -source-filename %s -pos=5:11 -end-pos=5:18 >> %t.result/one.swift
15
+ // RUN: diff -u %S/Outputs/await/one.swift.expected %t.result/one.swift
16
+ // RUN: %refactor -extract-repeat -source-filename %s -pos=7:11 -end-pos=7:26 >> %t.result/two.swift
17
+ // RUN: diff -u %S/Outputs/await/two.swift.expected %t.result/two.swift
You can’t perform that action at this time.
0 commit comments