summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2014-11-04 10:20:35 -0800
committerIan Lance Taylor <iant@golang.org>2014-11-04 10:20:35 -0800
commita2b2ebdbfcf213a434642cdc27ed0bab244207ac (patch)
tree755c45e771918a8c5e25f80a23dee75d1704db4b /test
parent44ac5f9624eb5d83e576cdcebf6e8f542bebaf37 (diff)
downloadgo-a2b2ebdbfcf213a434642cdc27ed0bab244207ac.tar.gz
test: comment out failing cases from sinit.go
One failing case this removes is: var bytes = []byte("hello, world") var copy_bytes = bytes We could handle this in the compiler, but it requires special case for a variable that is initialized to the value of a variable that is initialized to a string literal converted to []byte. This seems an unlikely case--it never occurs in the standrd library--and it seems unnecessary to write the code to handle it. If we do want to support this case, one approach is https://codereview.appspot.com/171840043. The other failing cases are of the form var bx bool var copy_bx = bx The compiler used to initialize copy_bx to false. However, that led to issue 7665, since bx may be initialized in non-Go code. The compiler no longer assumes that bx must be false, so copy_bx can not be statically initialized. We can fix these with https://codereview.appspot.com/169040043 if we also pass -complete to the compiler as part of this test. This is OK but it's too late in the release cycle. Fixes issue 8746. LGTM=rsc R=rsc CC=golang-codereviews https://codereview.appspot.com/165400043
Diffstat (limited to 'test')
-rw-r--r--test/sinit.go43
1 files changed, 29 insertions, 14 deletions
diff --git a/test/sinit.go b/test/sinit.go
index 5e50e1100..52dfd6fe4 100644
--- a/test/sinit.go
+++ b/test/sinit.go
@@ -112,7 +112,14 @@ var (
copy_slice = slice
copy_sliceInt = sliceInt
copy_hello = hello
- copy_bytes = bytes
+
+ // 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
@@ -202,58 +209,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