Files
swift-mirror/validation-test/stdlib/BoolDiagnostics_Dataflow.swift
Luciano Almeida ddeb1929c4 [DiagnosticQol][SR-14505] Use DeclDescriptive kind in missing return data flow diagnostics (#36952)
* [Diagnostics] Use DeclDescriptiveKind on data flow diagnostics to improve diagnostic message

* [tests] Add regression tests to SILOptimizer/return.swift

* [tests] Adapt other tests to changes of SR-14505

* [Diagnostics] Adapt message for missing return diagnostics, remove article

* [Diagnostics] Adapt message for missing return diagnostics to have a note with fix

* [tests] Adjust tests in validation suit
2021-04-20 08:16:32 -03:00

57 lines
1.5 KiB
Swift

// RUN: %target-swift-frontend -emit-sil -verify %s
@_silgen_name("opaque")
func opaque() -> Int
func test_constantFoldAnd1() -> Int {
while true && true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldAnd2() -> Int {
while true && false {
return 42
}
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldAnd3() -> Int {
while false && true {
return 42
}
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldAnd4() -> Int {
while false && false {
return 42
}
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldOr1() -> Int {
while true || true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldOr2() -> Int {
while true || false {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldOr3() -> Int {
while false || true {
return 42
}
// FIXME: this is a false positive.
} // expected-error {{missing return in global function expected to return 'Int'}}
func test_constantFoldOr4() -> Int {
while false || false {
return 42
}
} // expected-error {{missing return in global function expected to return 'Int'}}