Skip to content

Commit ab24b7b

Browse files
committed
gopls/internal/regtest/marker: add a test case for issue #59554
Fixes golang/go#59554 Change-Id: I66dfd9185770ff177841be7417424824975fa641 Reviewed-on: https://go-review.googlesource.com/c/tools/+/490315 TryBot-Result: Gopher Robot <[email protected]> gopls-CI: kokoro <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 8235df3 commit ab24b7b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
Test case for golang/go#59554: data corruption on formatting due to line
2+
directives.
3+
4+
Note that gofumpt is needed for this test case, as it reformats var decls into
5+
short var decls.
6+
7+
Note that gofumpt requires Go 1.18.
8+
9+
-- flags --
10+
-min_go=go1.18
11+
12+
-- settings.json --
13+
{
14+
"formatting.gofumpt": true
15+
}
16+
-- main.go --
17+
package main //@format(main)
18+
19+
func Match(data []byte) int {
20+
//line :1
21+
var idx = ^uint(0)
22+
_ = idx
23+
return -1
24+
}
25+
-- @main --
26+
package main //@format(main)
27+
28+
func Match(data []byte) int {
29+
//line :1
30+
idx := ^uint(0)
31+
_ = idx
32+
return -1
33+
}

0 commit comments

Comments
 (0)