diff options
author | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
---|---|---|
committer | Tianon Gravi <admwiggin@gmail.com> | 2015-01-15 11:54:00 -0700 |
commit | f154da9e12608589e8d5f0508f908a0c3e88a1bb (patch) | |
tree | f8255d51e10c6f1e0ed69702200b966c9556a431 /test/sinit.go | |
parent | 8d8329ed5dfb9622c82a9fbec6fd99a580f9c9f6 (diff) | |
download | golang-upstream/1.4.tar.gz |
Imported Upstream version 1.4upstream/1.4
Diffstat (limited to 'test/sinit.go')
-rw-r--r-- | test/sinit.go | 77 |
1 files changed, 46 insertions, 31 deletions
diff --git a/test/sinit.go b/test/sinit.go index 5e50e1100..df1a4cc93 100644 --- a/test/sinit.go +++ b/test/sinit.go @@ -1,7 +1,4 @@ -// $G -S $D/$F.go | egrep initdone >/dev/null && echo BUG sinit || true - -// NOTE: This test is not run by 'run.go' and so not run by all.bash. -// To run this test you must use the ./run shell script. +// skip // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style @@ -9,6 +6,7 @@ // Test that many initializations can be done at link time and // generate no executable init functions. +// This test is run by sinit_run.go. package p @@ -106,20 +104,27 @@ var answers = [...]int{ } var ( - copy_zero = zero - copy_one = one - copy_pi = pi - copy_slice = slice + copy_zero = zero + copy_one = one + copy_pi = pi + copy_slice = slice copy_sliceInt = sliceInt - copy_hello = hello - copy_bytes = bytes + copy_hello = hello + + // Could be handled without an initialization function, but + // requires special handling for "a = []byte("..."); b = a" + // which is not a likely case. + // copy_bytes = bytes + // https://codereview.appspot.com/171840043 is one approach to + // make this special case work. + copy_four, copy_five = four, five - copy_x, copy_y = x, y - copy_nilslice = nilslice - copy_nilmap = nilmap - copy_nilfunc = nilfunc - copy_nilchan = nilchan - copy_nilptr = nilptr + copy_x, copy_y = x, y + copy_nilslice = nilslice + copy_nilmap = nilmap + copy_nilfunc = nilfunc + copy_nilchan = nilchan + copy_nilptr = nilptr ) var copy_a = a @@ -172,7 +177,7 @@ var sx []int var s0 = []int{0, 0, 0} var s1 = []int{1, 2, 3} -func fi() int +func fi() int { return 1 } var ax [10]int var a0 = [10]int{0, 0, 0} @@ -202,58 +207,66 @@ var pt0b = &T{X: 0} var pt1 = &T{X: 1, Y: 2} var pt1a = &T{3, 4} -var copy_bx = bx +// The checks similar to +// var copy_bx = bx +// are commented out. The compiler no longer statically initializes them. +// See issue 7665 and https://codereview.appspot.com/93200044. +// If https://codereview.appspot.com/169040043 is submitted, and this +// test is changed to pass -complete to the compiler, then we can +// uncomment the copy lines again. + +// var copy_bx = bx var copy_b0 = b0 var copy_b1 = b1 -var copy_fx = fx +// var copy_fx = fx var copy_f0 = f0 var copy_f1 = f1 -var copy_gx = gx +// var copy_gx = gx var copy_g0 = g0 var copy_g1 = g1 -var copy_ix = ix +// var copy_ix = ix var copy_i0 = i0 var copy_i1 = i1 -var copy_jx = jx +// var copy_jx = jx var copy_j0 = j0 var copy_j1 = j1 -var copy_cx = cx +// var copy_cx = cx var copy_c0 = c0 var copy_c1 = c1 -var copy_dx = dx +// var copy_dx = dx var copy_d0 = d0 var copy_d1 = d1 -var copy_sx = sx +// var copy_sx = sx var copy_s0 = s0 var copy_s1 = s1 -var copy_ax = ax +// var copy_ax = ax var copy_a0 = a0 var copy_a1 = a1 -var copy_tx = tx +// var copy_tx = tx var copy_t0 = t0 var copy_t0a = t0a var copy_t0b = t0b var copy_t1 = t1 var copy_t1a = t1a -var copy_psx = psx +// var copy_psx = psx var copy_ps0 = ps0 var copy_ps1 = ps1 -var copy_pax = pax +// var copy_pax = pax var copy_pa0 = pa0 var copy_pa1 = pa1 -var copy_ptx = ptx +// var copy_ptx = ptx var copy_pt0 = pt0 var copy_pt0a = pt0a var copy_pt0b = pt0b @@ -266,6 +279,8 @@ type T1 int func (t *T1) M() {} -type Mer interface { M() } +type Mer interface { + M() +} var _ Mer = (*T1)(nil) |