Files
Allan Shortlidge cf5ed12f62 Sema: Offer fix-its for useless conditional statements.
When an `if` or `guard` statement is diagnosed as always succeeding, emit a
fix-it that removes the redundant statement. For `if`, the then-branch body
replaces the entire statement, dedented to match the surrounding indentation
level, like this:

```
// Before
if case let _ = x {
  doSomething()
} else {
  // ...
}

// After
doSomething()
```

For `guard`, the entire statement is removed (its body is unreachable). For an
`else if` branch, the inner `if` is replaced with just its body braces, turning
`else if X { body } [else ...]` into `else { body }` and discarding any
now-unreachable trailing branches.

No fix-it is offered for `while`, since removing the always-true condition
would produce an unconditional infinite loop.

Resolves rdar://178194980.
2026-05-29 15:54:04 -07:00
..
2026-03-14 17:47:51 -04:00