You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go/analysis/passes/nilness: improve "for range []T(nil)" error
Previously, the error message referred to a "nil dereference
in index operation", which is true, but the index operation
is unreachable because the range loop over a nil slice is
degenerate. Rephrase it to "index of nil slice",
which doesn't promise that the operation will panic,
or "range over nil slice" if we can infer that the
IndexAddr operation came from range-over-slice lowering.
Also, add cases for range over a nil map, *array, and chan,
with tests.
Fixesgolang/go#65674
Change-Id: I1bf89bd1118b191a493bc2f230cb1388ff7a9b3b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/563476
Reviewed-by: Lasse Folger <[email protected]>
Reviewed-by: Tim King <[email protected]>
Auto-Submit: Alan Donovan <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
0 commit comments