Skip to content

Commit

Permalink
go/constant: document that BinaryOp doesn't handle comparisons or shifts
Browse files Browse the repository at this point in the history
Fixes #17797.

Change-Id: I544df81c4bcf3cbd36a793be40050f14f9a9974f
Reviewed-on: https://go-review.googlesource.com/32761
Reviewed-by: Dominik Honnef <[email protected]>
  • Loading branch information
griesemer committed Nov 5, 2016
1 parent d0cf042 commit 2b445c7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/go/constant/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2b445c7

Please sign in to comment.