[SR-9475] Fix it to suggest if let
when writing if x != nil { something(x!) }
#51937
Labels
if let
when writing if x != nil { something(x!) }
#51937
Additional Detail from JIRA
md5: b35dbc6f299a6bbe86dc676d3754444e
Issue Description:
Given this code:
Swift should warn and provide a fix-it to suggest that you write this instead:
(This would need to not provide a fixit if the variable is used as an l-value.)
I've seen a lot of code that does the former. It tends to make code more complicated, resulting in downstream nullability checks that aren't required. The compiler should help here.
The text was updated successfully, but these errors were encountered: