|
|
| Previous ID |
SR-7307 |
| Radar |
None |
| Original Reporter |
@jckarter |
| Type |
Bug |
| Status |
Closed |
| Resolution |
Done |
Additional Detail from JIRA
|
|
| Votes |
1 |
| Component/s |
Compiler |
| Labels |
Bug, DiagnosticsQoI, StarterBug |
| Assignee |
@vguerra |
| Priority |
Medium |
md5: 9b4fc281235964efdf067b80f3a93de4
Issue Description:
A user used to Go's defer, or expecting Go-like behavior from first principles, may write something like this:
if x {
defer { thing_i_only_want_to_happen_when_x() }
}
which is going to run thing_i_only_want_to_happen_when_x at the exit of the if scope rather than at the end of the function. If a block contains nothing but a `defer`, the defer is useless, and we should probably warn to that effect.
Additional Detail from JIRA
md5: 9b4fc281235964efdf067b80f3a93de4
Issue Description:
A user used to Go's defer, or expecting Go-like behavior from first principles, may write something like this:
which is going to run
thing_i_only_want_to_happen_when_xat the exit of the if scope rather than at the end of the function. If a block contains nothing but a `defer`, the defer is useless, and we should probably warn to that effect.