From 9a58aa267e3686c86d3e5bf1d14117a2a127838c Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 10 Sep 2021 17:06:43 -0700 Subject: spec: fix prose about terminating statements CL 85215 added prose to provide some minimal intuition for the definition of a "terminating statement". While the original definition was perfectly fine, the added prose was actually incorrect: If the terminating statement is a goto, it might jump to a labeled statement following that goto in the same block (it could be the very next statement), and thus a terminating statement does not in fact "prevent execution of all statements that lexically appear after it in the same block". Rather than explaining the special case for gotos with targets that are lexically following the goto in the same block, this CL opts for a simpler approach. Thanks to @3bodar (Github) for finding this. Fixes #48323. Change-Id: I8031346250341d038938a1ce6a75d3e687d32c37 Reviewed-on: https://go-review.googlesource.com/c/go/+/349172 Trust: Robert Griesemer Trust: Emmanuel Odeke Reviewed-by: Matthew Dempsky Reviewed-by: Emmanuel Odeke Reviewed-by: Rob Pike Reviewed-by: Ian Lance Taylor --- doc/go_spec.html | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/go_spec.html b/doc/go_spec.html index 3e97974d6d..6cc0b796b9 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,6 +1,6 @@ @@ -4561,9 +4561,8 @@ SimpleStmt = EmptyStmt | ExpressionStmt | SendStmt | IncDecStmt | Assignment | S

Terminating statements

-A terminating statement prevents execution of all statements that lexically -appear after it in the same block. The following statements -are terminating: +A terminating statement interrupts the regular flow of control in +a block. The following statements are terminating:

    -- cgit v1.2.3-54-g00ecf