compiler: don't incorrectly evaluate range variable

The language spec says that in `for i = range x`, in which there is no
second iteration variable, if len(x) is constant, then x is not
evaluated.  This only matters when x is an expression that panics but
whose type is an array type; in such a case, we should not evaluate x,
since len of any array type is a constant.

Fixes golang/go#22313

Change-Id: I1c82e09a7dcf8f1e420ee6b2e789e870271755fe
Reviewed-on: https://go-review.googlesource.com/91555
Reviewed-by: Than McIntosh <thanm@google.com>
1 file changed