1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:04:41 -07:00

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>
This commit is contained in:
Robert Griesemer 2016-11-05 13:14:23 -07:00
parent d0cf042171
commit 2b445c7645

View File

@ -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.