aboutsummaryrefslogtreecommitdiff
path: root/doc/go_spec.html
diff options
context:
space:
mode:
authorBryan C. Mills <bcmills@google.com>2018-04-13 11:57:13 -0400
committerBryan C. Mills <bcmills@google.com>2018-05-09 20:36:22 +0000
commitdf480036185715432a6e3f740e65bceed26c748f (patch)
tree32b8a61b0fd13f3596972155598115db96f250bf /doc/go_spec.html
parent4410934cbad454539312468aca276111c08f5582 (diff)
downloadgo-df480036185715432a6e3f740e65bceed26c748f.tar.gz
go-df480036185715432a6e3f740e65bceed26c748f.zip
spec: clarify “Constant expressions” for untyped operands
This change addresses the grammatical complexity described in https://groups.google.com/forum/#!topic/golang-dev/RmP-LMC3g58. Change-Id: Ib292b4ca9c880c7c1c8c992e7c033a0f8f951f2c Reviewed-on: https://go-review.googlesource.com/106855 Reviewed-by: Robert Griesemer <gri@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'doc/go_spec.html')
-rw-r--r--doc/go_spec.html21
1 files changed, 12 insertions, 9 deletions
diff --git a/doc/go_spec.html b/doc/go_spec.html
index dbd2307e29..f1300c105a 100644
--- a/doc/go_spec.html
+++ b/doc/go_spec.html
@@ -1,6 +1,6 @@
<!--{
"Title": "The Go Programming Language Specification",
- "Subtitle": "Version of February 18, 2018",
+ "Subtitle": "Version of May 9, 2018",
"Path": "/ref/spec"
}-->
@@ -4160,11 +4160,6 @@ operands and are evaluated at compile time.
Untyped boolean, numeric, and string constants may be used as operands
wherever it is legal to use an operand of boolean, numeric, or string type,
respectively.
-Except for shift operations, if the operands of a binary operation are
-different kinds of untyped constants, the operation and, for non-boolean operations, the result use
-the kind that appears later in this list: integer, rune, floating-point, complex.
-For example, an untyped integer constant divided by an
-untyped complex constant yields an untyped complex constant.
</p>
<p>
@@ -4174,9 +4169,17 @@ an untyped boolean constant. If the left operand of a constant
result is an integer constant; otherwise it is a constant of the same
type as the left operand, which must be of
<a href="#Numeric_types">integer type</a>.
-Applying all other operators to untyped constants results in an untyped
-constant of the same kind (that is, a boolean, integer, floating-point,
-complex, or string constant).
+</p>
+
+<p>
+Any other operation on untyped constants results in an untyped constant of the
+same kind; that is, a boolean, integer, floating-point, complex, or string
+constant.
+If the untyped operands of a binary operation (other than a shift) are of
+different kinds, the result is of the operand's kind that appears later in this
+list: integer, rune, floating-point, complex.
+For example, an untyped integer constant divided by an
+untyped complex constant yields an untyped complex constant.
</p>
<pre>