Skip to content

[SR-7616] 'code will never execute' for compound conditions && other simple cases #50158

Open
@AnthonyLatsis

Description

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

md5: a72fd643f6cd244d0b74c73ad93da4eb

Issue Description:

There are relatively simple cases when we can show this warning, e.g.

func test(pred: Bool) {
  if false && pred {} // Doesn't warn
}

let i = 0
if i > 10 {} // Doesn't warn

let bool1 = true
if !bool1 {} // Warns

let bool2 = true || false
if !bool2 {} // Doesn't warn

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions