Skip to content

[DO NOT MERGE] Make Swift 3 / 4 consistent with SE-0054. #12682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

[DO NOT MERGE] Make Swift 3 / 4 consistent with SE-0054. #12682

wants to merge 1 commit into from

Conversation

rudkx
Copy link
Contributor

@rudkx rudkx commented Oct 31, 2017

As with Swift 5 mode, make Swift 3 / 4 reject IUOs in places where they are not allowed according to SE-0054.

@DougGregor
Copy link
Member

Looks like there were only two issues! RxSwift had this:

print(convertResponseToString(data, response, error as NSError!, interval))

which has been fixed in the upstream repository already.

Alamofire has this:

if let encodingName = response?.textEncodingName as CFString!, convertedEncoding == nil {

where the '!' is effectively unnecessary. The code is still there upstream at https://github.com/Alamofire/Alamofire/blob/master/Source/ResponseSerialization.swift#L371

@rudkx
Copy link
Contributor Author

rudkx commented Oct 31, 2017

Yup. It looks like we give a working fix-it in both cases as well (replace ! with ?).

@slavapestov
Copy link
Contributor

@rudkx One alternative is to emit this as a warning in Swift 3/4 mode, and continue parsing as if it were a ?.

@rudkx
Copy link
Contributor Author

rudkx commented Oct 31, 2017

@slavapestov Yes I mentioned that possibility in another forum. I think that's a reasonable choice for these casts, but probably not for something like [Int!] where other errors will surface and it will be even more confusing than just rejecting [Int!] in the first place.

@rudkx
Copy link
Contributor Author

rudkx commented Nov 1, 2017

@swift-ci Please smoke test

@rudkx rudkx changed the title [DO NOT MERGE] wip: experiment to see what breaks if we enforce IUO checks more stri… [DO NOT MERGE] Use the new test for where IUOs are allowed in all versions. Nov 1, 2017
@rudkx
Copy link
Contributor Author

rudkx commented Nov 1, 2017

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented Nov 1, 2017

Updated this commit since cef6c94 is now in, which addresses some bugs in the earlier commit.

This is now limited to switching over to using the new tests all the time.

I still do not plan on merging this without further investigation, but want to verify where things stand and fix up any remaining code in our tree (e.g. in tests) that I may have missed.

@rudkx
Copy link
Contributor Author

rudkx commented Nov 6, 2017

@swift-ci Please smoke test

@rudkx rudkx changed the title [DO NOT MERGE] Use the new test for where IUOs are allowed in all versions. [DO NOT MERGE] Make Swift 3 / 4 consistent with SE-0054. Nov 6, 2017
@rudkx
Copy link
Contributor Author

rudkx commented Nov 6, 2017

There is still a cast in Foundation that is disallowed by SE-0054. I opened swiftlang/swift-corelibs-foundation#1300 to make it a cast to Optional instead.

As with Swift 5 mode, make Swift 3 / 4 reject IUOs in places where they
are not allowed according to SE-0054.
@rudkx
Copy link
Contributor Author

rudkx commented Nov 7, 2017

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented Nov 7, 2017

Ran into a couple more casts in Foundation that need to be fixed up: swiftlang/swift-corelibs-foundation#1303

@rudkx
Copy link
Contributor Author

rudkx commented Nov 7, 2017

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented Nov 7, 2017

@swift-ci Please smoke test Linux platform

@rudkx
Copy link
Contributor Author

rudkx commented Nov 7, 2017

@swift-ci Please test source compatibility

@rudkx
Copy link
Contributor Author

rudkx commented Nov 8, 2017

Please test with following pull request:
#12682
swiftlang/swift-corelibs-foundation#1306

@swift-ci Please smoke test

@rudkx
Copy link
Contributor Author

rudkx commented Nov 9, 2017

@shahmishal Any idea what might have happened here? The multi-PR test doesn't seem to have actually started.

@shahmishal
Copy link
Member

This is was during CI outage yesterday.

Please test with following pull request:
#12682
swiftlang/swift-corelibs-foundation#1306

@swift-ci Please smoke test

@shahmishal
Copy link
Member

Also, it does not support same repository :(
Right now you can only provide one PR per repositories

@rudkx
Copy link
Contributor Author

rudkx commented Nov 10, 2017

Closing in favor of a new PR I will open soon.

@rudkx rudkx closed this Nov 10, 2017
@rudkx rudkx deleted the unconditional-iuo-checking branch December 19, 2017 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants