Skip to content

Commit 9a58aa2

Browse files
committed
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 <[email protected]> Trust: Emmanuel Odeke <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Reviewed-by: Emmanuel Odeke <[email protected]> Reviewed-by: Rob Pike <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 42057e9 commit 9a58aa2

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

doc/go_spec.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--{
22
"Title": "The Go Programming Language Specification",
3-
"Subtitle": "Version of Aug 23, 2021",
3+
"Subtitle": "Version of Sep 14, 2021",
44
"Path": "/ref/spec"
55
}-->
66

@@ -4561,9 +4561,8 @@ <h2 id="Statements">Statements</h2>
45614561
<h3 id="Terminating_statements">Terminating statements</h3>
45624562

45634563
<p>
4564-
A <i>terminating statement</i> prevents execution of all statements that lexically
4565-
appear after it in the same <a href="#Blocks">block</a>. The following statements
4566-
are terminating:
4564+
A <i>terminating statement</i> interrupts the regular flow of control in
4565+
a <a href="#Blocks">block</a>. The following statements are terminating:
45674566
</p>
45684567

45694568
<ol>

0 commit comments

Comments
 (0)