Skip to content

Commit 2b78469

Browse files
committed
Fix test
1 parent 0747484 commit 2b78469

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/testdata/exportloopref.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//args: -Eexportloopref
12
package testdata
23

34
func dummyFunction() {
@@ -8,19 +9,19 @@ func dummyFunction() {
89

910
println("loop expecting 10, 11, 12, 13")
1011
for i, p := range []int{10, 11, 12, 13} {
11-
printp(&p) // not a diagnostic
12-
slice = append(slice, &p) // want "exporting a pointer for the loop variable p"
13-
array[i] = &p // want "exporting a pointer for the loop variable p"
12+
printp(&p)
13+
slice = append(slice, &p) // ERROR : exporting a pointer for the loop variable p
14+
array[i] = &p // ERROR : exporting a pointer for the loop variable p
1415
if i%2 == 0 {
15-
ref = &p // want "exporting a pointer for the loop variable p"
16-
str.x = &p // want "exporting a pointer for the loop variable p"
16+
ref = &p // ERROR : exporting a pointer for the loop variable p
17+
str.x = &p // ERROR : exporting a pointer for the loop variable p
1718
}
1819
var vStr struct{ x *int }
1920
var vArray [4]*int
2021
var v *int
2122
if i%2 == 0 {
22-
v = &p // not a diagnostic (x is inner variable)
23-
vArray[1] = &p // not a diagnostic (x is inner variable)
23+
v = &p
24+
vArray[1] = &p
2425
vStr.x = &p
2526
}
2627
_ = v

0 commit comments

Comments
 (0)