Skip to content

Commit 2a6f58d

Browse files
rudkxkitasuke
authored andcommitted
[Migrator] Re-enable wrap_optional.swift test.
This had to be reworked a bit to deal with the fact that IUOs are no longer a distinct type and there were uses of IUOs that are not supported after SE-0054. Fixes: rdar://problem/37040141
1 parent 1ba4f54 commit 2a6f58d

File tree

4 files changed

+18
-20
lines changed

4 files changed

+18
-20
lines changed

test/Migrator/Inputs/API.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"NodeKind": "Function",
254254
"NodeAnnotation": "ImplicitOptionalToOptional",
255255
"ChildIndex": "1",
256-
"LeftUsr": "s:6CitiesAAC7yandina1xySQySays10DictionaryVySSABGGG_tF",
256+
"LeftUsr": "s:6CitiesAAC7yandina1xySays10DictionaryVySSABGGSg_tF",
257257
"LeftComment": "",
258258
"RightUsr": "",
259259
"RightComment": "",
@@ -264,7 +264,7 @@
264264
"NodeKind": "Function",
265265
"NodeAnnotation": "TypeRewritten",
266266
"ChildIndex": "1:0:0:0",
267-
"LeftUsr": "s:6CitiesAAC7yandina1xySQySays10DictionaryVySSABGGG_tF",
267+
"LeftUsr": "s:6CitiesAAC7yandina1xySays10DictionaryVySSABGGSg_tF",
268268
"LeftComment": "",
269269
"RightUsr": "",
270270
"RightComment": "Int",
@@ -341,7 +341,7 @@
341341
"NodeKind": "Function",
342342
"NodeAnnotation": "WrapOptional",
343343
"ChildIndex": "1",
344-
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySQySSGSSSg_SStXE_tF",
344+
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySSSgAF_SStXE_tF",
345345
"LeftComment": "",
346346
"RightUsr": "",
347347
"RightComment": "",
@@ -352,7 +352,7 @@
352352
"NodeKind": "Function",
353353
"NodeAnnotation": "WrapOptional",
354354
"ChildIndex": "1",
355-
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySQySSGSSSg_SStXE_tF",
355+
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySSSgAF_SStXE_tF",
356356
"LeftComment": "",
357357
"RightUsr": "",
358358
"RightComment": "",
@@ -363,7 +363,7 @@
363363
"NodeKind": "Function",
364364
"NodeAnnotation": "ImplicitOptionalToOptional",
365365
"ChildIndex": "1:0",
366-
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySQySSGSSSg_SStXE_tF",
366+
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySSSgAF_SStXE_tF",
367367
"LeftComment": "",
368368
"RightUsr": "",
369369
"RightComment": "",
@@ -374,7 +374,7 @@
374374
"NodeKind": "Function",
375375
"NodeAnnotation": "UnwrapOptional",
376376
"ChildIndex": "1:1:0",
377-
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySQySSGSSSg_SStXE_tF",
377+
"LeftUsr": "s:6Cities05ExtraA0P6blibli1xySSSgAF_SStXE_tF",
378378
"LeftComment": "",
379379
"RightUsr": "",
380380
"RightComment": "",
@@ -385,7 +385,7 @@
385385
"NodeKind": "Function",
386386
"NodeAnnotation": "ImplicitOptionalToOptional",
387387
"ChildIndex": "1",
388-
"LeftUsr": "s:6Cities05ExtraA0P10currimundi1xySQySi_Si_SittG_tF",
388+
"LeftUsr": "s:6Cities05ExtraA0P10currimundi1xySi_Si_SittSg_tF",
389389
"LeftComment": "",
390390
"RightUsr": "",
391391
"RightComment": "",
@@ -396,7 +396,7 @@
396396
"NodeKind": "Function",
397397
"NodeAnnotation": "WrapOptional",
398398
"ChildIndex": "1:0:1:0",
399-
"LeftUsr": "s:6Cities05ExtraA0P10currimundi1xySQySi_Si_SittG_tF",
399+
"LeftUsr": "s:6Cities05ExtraA0P10currimundi1xySi_Si_SittSg_tF",
400400
"LeftComment": "",
401401
"RightUsr": "",
402402
"RightComment": "",
@@ -429,7 +429,7 @@
429429
"NodeKind": "Function",
430430
"NodeAnnotation": "ImplicitOptionalToOptional",
431431
"ChildIndex": "0",
432-
"LeftUsr": "s:6CitiesAAC1ySQyABGSi_tcfc",
432+
"LeftUsr": "s:6CitiesAAC1yABSgSi_tcfc",
433433
"LeftComment": "",
434434
"RightUsr": "",
435435
"RightComment": "",

test/Migrator/Inputs/Cities.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ open class Cities {
1616

1717
public protocol ExtraCities {
1818
func coolum(x: [String : [Int : [(((String))?)]]])
19-
func blibli(x: (String?, String) -> String!)
19+
func blibli(x: (String?, String) -> String?)
2020
func currimundi(x: (Int, (Int, Int))!)
2121
}
2222

test/Migrator/wrap_optional.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// REQUIRES: objc_interop
2-
// FIXME: Disable until we deal with IUO being removed as a type
3-
// REQUIRES: rdar37040141
42
// RUN: %empty-directory(%t.mod)
53
// RUN: %target-swift-frontend -emit-module -o %t.mod/Cities.swiftmodule %S/Inputs/Cities.swift -module-name Cities -parse-as-library
64
// RUN: %empty-directory(%t) && %target-swift-frontend -c -update-code -disable-migrator-fixits -primary-file %s -I %t.mod -api-diff-data-file %S/Inputs/API.json -emit-migrated-file-path %t/wrap_optional.swift.result -o /dev/null
@@ -33,13 +31,13 @@ extension ExtraCities {
3331
}
3432

3533
class MyExtraCities : ExtraCities {
36-
func blibli(x: (String?, String) -> String!) {}
34+
func blibli(x: (String?, String) -> String?) {}
3735
func currimundi(x: (Int, (Int, Int))!) {}
3836
}
3937

4038
typealias IntAnd<T> = (Int, T)
4139
class Outer {
42-
typealias Inner = (String?, String) -> String!
40+
typealias Inner = (String?, String) -> String?
4341
}
4442

4543
class MyExtraCitiesWithAliases : ExtraCities {
@@ -48,9 +46,9 @@ class MyExtraCitiesWithAliases : ExtraCities {
4846
}
4947

5048
typealias OptString = String?
51-
typealias ImplicitlyUnwrapped<T> = T!
49+
typealias OptGeneric<T> = T?
5250

5351
class MyExtraCitiesWithMoreAliases : ExtraCities {
54-
func blibli(x: (OptString, String) -> String!) {}
55-
func currimundi(x: ImplicitlyUnwrapped<(Int, (Int, Int))>) {}
52+
func blibli(x: (OptString, String) -> String?) {}
53+
func currimundi(x: OptGeneric<(Int, (Int, Int))>) {}
5654
}

test/Migrator/wrap_optional.swift.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class MyExtraCities : ExtraCities {
3737

3838
typealias IntAnd<T> = (Int, T)
3939
class Outer {
40-
typealias Inner = (String?, String) -> String!
40+
typealias Inner = (String?, String) -> String?
4141
}
4242

4343
class MyExtraCitiesWithAliases : ExtraCities {
@@ -46,9 +46,9 @@ class MyExtraCitiesWithAliases : ExtraCities {
4646
}
4747

4848
typealias OptString = String?
49-
typealias ImplicitlyUnwrapped<T> = T!
49+
typealias OptGeneric<T> = T?
5050

5151
class MyExtraCitiesWithMoreAliases : ExtraCities {
5252
func blibli(x: ((OptString, String) -> String?)?) {}
53-
func currimundi(x: ImplicitlyUnwrapped<(Int, (Int, Int))>) {}
53+
func currimundi(x: OptGeneric<(Int, (Int, Int))>) {}
5454
}

0 commit comments

Comments
 (0)