-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/analysis/yield: peephole-optimize phi(false, x)
The yield analyzer reports spurious diagnostics for constructs such as: func f(yield func() bool) { ok := yield() // yield may be called again ok = ok && yield() // yield may be called again ok = ok && yield() } This CL reduces phi(false, yield()) conditions as a special case. The test suite includes a counterexample that still elicits a false positive. If variants of this sort show up in practice, we may need a more systematic treatment of dominating conditions, similar to the nilness analysis, or even a full monotone framework with lattice joins and fixed point iteration. Fixes golang/go#70598 Change-Id: Ia602602cf5c233820d8ddbe73a286799bb3ea16c Reviewed-on: https://go-review.googlesource.com/c/tools/+/632117 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Findley <rfindley@google.com>
- Loading branch information
Showing
2 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters