aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2016-11-05 13:14:23 -0700
committerRobert Griesemer <gri@golang.org>2016-11-05 23:59:04 +0000
commit2b445c76453ee79d02ea50f50f619d8f7250fa87 (patch)
tree4063a481316572235716973a974825eaea827047
parentd0cf0421717a93b705efcbce0770a24361582445 (diff)
downloadgo-2b445c76453ee79d02ea50f50f619d8f7250fa87.tar.gz
go-2b445c76453ee79d02ea50f50f619d8f7250fa87.zip
go/constant: document that BinaryOp doesn't handle comparisons or shifts
Fixes #17797. Change-Id: I544df81c4bcf3cbd36a793be40050f14f9a9974f Reviewed-on: https://go-review.googlesource.com/32761 Reviewed-by: Dominik Honnef <dominik@honnef.co>
-rw-r--r--src/go/constant/value.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/go/constant/value.go b/src/go/constant/value.go
index 90c04df88d..85f53b4d16 100644
--- a/src/go/constant/value.go
+++ b/src/go/constant/value.go
@@ -936,6 +936,9 @@ func match(x, y Value) (_, _ Value) {
// BinaryOp returns the result of the binary expression x op y.
// The operation must be defined for the operands. If one of the
// operands is Unknown, the result is Unknown.
+// BinaryOp doesn't handle comparisons or shifts; use Compare
+// or Shift instead.
+//
// To force integer division of Int operands, use op == token.QUO_ASSIGN
// instead of token.QUO; the result is guaranteed to be Int in this case.
// Division by zero leads to a run-time panic.