diff options
author | Robert Griesemer <gri@golang.org> | 2020-11-19 17:49:05 -0800 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2020-11-20 02:39:33 +0000 |
commit | 8fbdacf64c982b9a7f8cb27754bb01cedffa53c7 (patch) | |
tree | bd081b1462580df8e41b37b00187531a3575262a /src/go/types/expr.go | |
parent | b1ae0a0646d062559249675e6bf6883b44094046 (diff) | |
download | go-8fbdacf64c982b9a7f8cb27754bb01cedffa53c7.tar.gz go-8fbdacf64c982b9a7f8cb27754bb01cedffa53c7.zip |
[dev.typeparams] cmd/compile/internal/types2: report constant overflow in binary ops
This is the go.types changes of https://golang.org/cl/271706
ported to types2.
Also: Fixed a bug in the go/types version (was using the
wrong position in the error message).
Change-Id: I798b80243a66f0be5b943a6951d7a1ff769abca2
Reviewed-on: https://go-review.googlesource.com/c/go/+/271806
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/go/types/expr.go')
-rw-r--r-- | src/go/types/expr.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/go/types/expr.go b/src/go/types/expr.go index 4e19f30477..eb2056125a 100644 --- a/src/go/types/expr.go +++ b/src/go/types/expr.go @@ -890,7 +890,7 @@ func (check *Checker) binary(x *operand, e *ast.BinaryExpr, lhs, rhs ast.Expr, o // TODO(gri) We should report exactly what went wrong. At the // moment we don't have the (go/constant) API for that. // See also TODO in go/constant/value.go. - check.errorf(atPos(e.OpPos), _InvalidConstVal, "constant result is not representable") + check.errorf(atPos(opPos), _InvalidConstVal, "constant result is not representable") // TODO(gri) Should we mark operands with unknown values as invalid? } // Typed constants must be representable in |