aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmelia Downs <adowns@vmware.com>2021-09-20 13:04:49 -0400
committerRobert Griesemer <gri@golang.org>2021-09-20 21:40:06 +0000
commitb0fa2f5b09acfa5604e78cafc2183f3e1eac061b (patch)
tree3a1937f888ffde812f9ed231989af956d8d0ecdf
parentaf72ddfcd7826df9aefb2207b8ac270bb91fea2f (diff)
downloadgo-b0fa2f5b09acfa5604e78cafc2183f3e1eac061b.tar.gz
go-b0fa2f5b09acfa5604e78cafc2183f3e1eac061b.zip
cmd/compile: fix ExampleInfo output
Move the "TODO" to outside of the function so that the "Output" comment block is the last comment block. Output is only checked when it is the last comment block. See golang/go#48362 for this issue. Fixes: golang/go#48494 Change-Id: I7a31d7c13710e58fa876c96240a927a9bb8273ad Reviewed-on: https://go-review.googlesource.com/c/go/+/350995 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: David Chase <drchase@google.com>
-rw-r--r--src/cmd/compile/internal/types2/example_test.go56
1 files changed, 28 insertions, 28 deletions
diff --git a/src/cmd/compile/internal/types2/example_test.go b/src/cmd/compile/internal/types2/example_test.go
index 714bf778213..4edaad580e5 100644
--- a/src/cmd/compile/internal/types2/example_test.go
+++ b/src/cmd/compile/internal/types2/example_test.go
@@ -216,36 +216,36 @@ func fib(x int) int {
// var x int:
// defined at fib.go:8:10
// used at 10:10, 12:13, 12:24, 9:5
-
- // TODO(gri) Enable once positions are updated/verified
- // Types and Values of each expression:
- // 4: 8 | string | type : string
- // 6:15 | len | builtin : func(string) int
- // 6:15 | len(b) | value : int
- // 6:19 | b | var : fib.S
- // 6:23 | S | type : fib.S
- // 6:23 | S(c) | value : fib.S
- // 6:25 | c | var : string
- // 6:29 | "hello" | value : string = "hello"
- // 8:12 | int | type : int
- // 8:17 | int | type : int
- // 9: 5 | x | var : int
- // 9: 5 | x < 2 | value : untyped bool
- // 9: 9 | 2 | value : int = 2
- // 10:10 | x | var : int
- // 12: 9 | fib | value : func(x int) int
- // 12: 9 | fib(x - 1) | value : int
- // 12: 9 | fib(x - 1) - fib(x - 2) | value : int
- // 12:13 | x | var : int
- // 12:13 | x - 1 | value : int
- // 12:15 | 1 | value : int = 1
- // 12:20 | fib | value : func(x int) int
- // 12:20 | fib(x - 2) | value : int
- // 12:24 | x | var : int
- // 12:24 | x - 2 | value : int
- // 12:26 | 2 | value : int = 2
}
+// TODO(gri) Enable once positions are updated/verified
+// Types and Values of each expression:
+// 4: 8 | string | type : string
+// 6:15 | len | builtin : func(string) int
+// 6:15 | len(b) | value : int
+// 6:19 | b | var : fib.S
+// 6:23 | S | type : fib.S
+// 6:23 | S(c) | value : fib.S
+// 6:25 | c | var : string
+// 6:29 | "hello" | value : string = "hello"
+// 8:12 | int | type : int
+// 8:17 | int | type : int
+// 9: 5 | x | var : int
+// 9: 5 | x < 2 | value : untyped bool
+// 9: 9 | 2 | value : int = 2
+// 10:10 | x | var : int
+// 12: 9 | fib | value : func(x int) int
+// 12: 9 | fib(x - 1) | value : int
+// 12: 9 | fib(x - 1) - fib(x - 2) | value : int
+// 12:13 | x | var : int
+// 12:13 | x - 1 | value : int
+// 12:15 | 1 | value : int = 1
+// 12:20 | fib | value : func(x int) int
+// 12:20 | fib(x - 2) | value : int
+// 12:24 | x | var : int
+// 12:24 | x - 2 | value : int
+// 12:26 | 2 | value : int = 2
+
func mode(tv types2.TypeAndValue) string {
switch {
case tv.IsVoid():