Skip to content
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

[SR-1658] No warning for unmodified var on two paths #44267

Open
belkadan opened this issue Jun 2, 2016 · 1 comment
Open

[SR-1658] No warning for unmodified var on two paths #44267

belkadan opened this issue Jun 2, 2016 · 1 comment
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement

Comments

@belkadan
Copy link
Contributor

belkadan commented Jun 2, 2016

Previous ID SR-1658
Radar None
Original Reporter @belkadan
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI
Assignee None
Priority Medium

md5: 8cad64b803ed2a0d4e0a26fa1c4cd02d

Issue Description:

func test() {
  var x: Int
  if Int("abc") == nil {
    x = 1
  } else {
    x = 2
  }
  print(x)
}

This contrived example ought to give us a warning to change the var back into a let. Unfortunately, as a path-sensitive check this isn't quite trivial.

@Dante-Broggi
Copy link
Contributor

This still occurs in the Xcode 10 toolchain.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement
Projects
None yet
Development

No branches or pull requests

2 participants