diff --git a/ssa/interp/testdata/initorder.go b/ssa/interp/testdata/initorder.go index 34b65675..61dee945 100644 --- a/ssa/interp/testdata/initorder.go +++ b/ssa/interp/testdata/initorder.go @@ -2,8 +2,6 @@ package main // Test of initialization order of package-level vars. -type T int - var counter int func next() int { @@ -12,17 +10,15 @@ func next() int { return c } -func (T) next() int { - return next() -} - -var t T - func makeOrder1() [6]int { + // The values of these vars are determined by the (arbitrary) + // order in which we refer to them here. f=0, b=1, d=2, etc. return [6]int{f1, b1, d1, e1, c1, a1} } func makeOrder2() [6]int { + // The values of these vars are independent of the order in + // which we refer to them here. a=6, b=7, c=8, etc. return [6]int{f2, b2, d2, e2, c2, a2} } @@ -30,7 +26,7 @@ var order1 = makeOrder1() func main() { // order1 is a package-level variable: - // [a-f]1 are initialized is reference order. + // [a-f]1 are initialized in reference order. if order1 != [6]int{0, 1, 2, 3, 4, 5} { panic(order1) } @@ -43,13 +39,10 @@ func main() { } } -// The references traversal visits through calls to package-level -// functions (next), method expressions (T.next) and methods (t.next). - var a1, b1 = next(), next() -var c1, d1 = T.next(0), T.next(0) -var e1, f1 = t.next(), t.next() +var c1, d1 = next(), next() +var e1, f1 = next(), next() var a2, b2 = next(), next() -var c2, d2 = T.next(0), T.next(0) -var e2, f2 = t.next(), t.next() +var c2, d2 = next(), next() +var e2, f2 = next(), next()