Skip to content

[5.0][CSDiagnostics] Diagnose invalid optional unwrap via fixes #21124

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

Merged
merged 2 commits into from
Dec 8, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 7, 2018

Detect and fix situations when (force) unwrap is used on
a non-optional type, this helps to diagnose invalid unwraps
precisely and provide fix-its.

Resolves: SR-8977
Resolves: rdar://problem/45218255

xedin added 2 commits December 7, 2018 12:52
If the base type is not optional, trying to unwrap it is
incorrect. Introduce a fix to make it look like base was
an optional type which leads solver to move forward
towards possible solution.

(cherry picked from commit e043e2b)
Detect and fix situations when (force) unwrap is used on
a non-optional type, this helps to diagnose invalid unwraps
precisely and provide fix-its.

Resolves: [SR-8977](https://bugs.swift.org/browse/SR-8977)
Resolves: rdar://problem/45218255
(cherry picked from commit 202234f)
@xedin xedin requested a review from AnnaZaks December 7, 2018 20:54
@xedin xedin requested a review from a team as a code owner December 7, 2018 20:54
@xedin
Copy link
Contributor Author

xedin commented Dec 7, 2018

@swift-ci please test

@AnnaZaks
Copy link
Contributor

AnnaZaks commented Dec 8, 2018

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2018

Just FYI that this code is not going to run when everything type-checks correctly.

@AnnaZaks AnnaZaks merged commit c14e1a3 into swiftlang:swift-5.0-branch Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants