Skip to content

Commit c472c90

Browse files
authored
Merge pull request #21888 from akyrtzi/migrate-index-where
[migrator] Migrate '.index(where:)' to '.firstIndex(where:)'
2 parents ff51b7b + 90f2207 commit c472c90

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

lib/Migrator/overlay4.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,4 +1332,15 @@
13321332
"RightComment": "firstIndex",
13331333
"ModuleName": "Swift"
13341334
},
1335+
{
1336+
"DiffItemKind": "CommonDiffItem",
1337+
"NodeKind": "Function",
1338+
"NodeAnnotation": "Rename",
1339+
"ChildIndex": "0",
1340+
"LeftUsr": "s:SlsE5index5where5IndexQzSgSb7ElementQzKXE_tKF",
1341+
"LeftComment": "index",
1342+
"RightUsr": "",
1343+
"RightComment": "firstIndex",
1344+
"ModuleName": "Swift"
1345+
},
13351346
]

lib/Migrator/overlay42.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,15 @@
1010
"RightComment": "firstIndex",
1111
"ModuleName": "Swift"
1212
},
13+
{
14+
"DiffItemKind": "CommonDiffItem",
15+
"NodeKind": "Function",
16+
"NodeAnnotation": "Rename",
17+
"ChildIndex": "0",
18+
"LeftUsr": "s:SlsE5index5where5IndexQzSgSb7ElementQzKXE_tKF",
19+
"LeftComment": "index",
20+
"RightUsr": "",
21+
"RightComment": "firstIndex",
22+
"ModuleName": "Swift"
23+
},
1324
]

test/Migrator/stdlib_rename.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
func test1(_ a: [String], s: String) {
88
_ = a.index(of: s)
9+
_ = a.index(where: { _ in true })
910
}
1011
func test2(_ s: String, c: Character) {
1112
_ = s.index(of: c)

test/Migrator/stdlib_rename.swift.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
func test1(_ a: [String], s: String) {
88
_ = a.firstIndex(of: s)
9+
_ = a.firstIndex(where: { _ in true })
910
}
1011
func test2(_ s: String, c: Character) {
1112
_ = s.firstIndex(of: c)

0 commit comments

Comments
 (0)