mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead, check them and their error handling right away. In addition to fixing the crash in the radar, this also causes us to emit unused variable warnings in functions containing local functions. Eventually, TC.definedFunctions should go away altogether. Fixes <rdar://problem/53956342>.
24 lines
517 B
Swift
24 lines
517 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
let x = 1
|
|
let y = 2
|
|
if (x > y) {
|
|
defer { // expected-warning {{'defer' statement at end of scope always executes immediately}}{{5-10=do}}
|
|
print("not so useful defer stmt.")
|
|
}
|
|
}
|
|
|
|
func sr7307(_ value: Bool) {
|
|
let negated = !value
|
|
defer { // expected-warning {{'defer' statement at end of scope always executes immediately}}{{5-10=do}}
|
|
print("negated value is \(negated)")
|
|
}
|
|
}
|
|
|
|
sr7307(true)
|
|
|
|
defer { // No note
|
|
print("end of program.")
|
|
}
|
|
|