aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/expr.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2020-11-19 17:49:05 -0800
committerRobert Griesemer <gri@golang.org>2020-11-20 02:39:33 +0000
commit8fbdacf64c982b9a7f8cb27754bb01cedffa53c7 (patch)
treebd081b1462580df8e41b37b00187531a3575262a /src/go/types/expr.go
parentb1ae0a0646d062559249675e6bf6883b44094046 (diff)
downloadgo-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.go2
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