]> Cypherpunks.ru repositories - gostls13.git/commitdiff
allow type name as key to accomodate anonymous fields.
authorRuss Cox <rsc@golang.org>
Thu, 21 May 2009 23:31:10 +0000 (16:31 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 21 May 2009 23:31:10 +0000 (16:31 -0700)
update tests.

R=ken
OCL=29207
CL=29207

src/cmd/gc/go.y
test/golden.out
test/initialize.go
test/initializerr.go

index 0841d5d90e1016613babe86644353b57d3c95d63..0fae90b7faceb741c2fb901b230c1f9d6c6716e8 100644 (file)
@@ -1363,6 +1363,11 @@ keyval:
        {
                $$ = nod(OKEY, $1, $3);
        }
+|      LATYPE ':' expr
+       {
+               $$ = nod(OKEY, newname($1), $3);
+       }
+
 
 /*
  * function stuff
index 6f0eb13400ffc3bf047fc83eb1ded74a6131fd7a..22b46b29b66095abc13e8c60d99e865532ae9419 100644 (file)
@@ -26,6 +26,10 @@ panic PC=xxx
 =========== ./helloworld.go
 hello, world
 
+=========== ./initializerr.go
+BUG: errchk: ./initializerr.go:15: missing expected error: 'duplicate'
+errchk: ./initializerr.go:17: missing expected error: 'index'
+
 =========== ./peano.go
 0! = 1
 1! = 1
index ba043147584af1cee3b756f274b9d772f152daf1..5fde9dabafbbd4781c96e2dee0780fa48b4dd034 100644 (file)
@@ -21,10 +21,10 @@ var a1 = S { 0, 0, 0, 1, 2, 3 }
 var b1 = S { X: 1, Z: 3, Y: 2 }
 
 var a2 = S { 0, 0, 0, 0, 0, 0, }
-var b2 S  // = S { }  TODO(rsc): should work
+var b2 = S { }
 
 var a3 = T { S { 1, 2, 3, 0, 0, 0, } }
-var b3 = T { S { A: 1, B: 2, C: 3 } }  // TODO(rsc): s/S/S:S/
+var b3 = T { S: S{ A: 1, B: 2, C: 3 } }
 
 var a4 = &[16]byte { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, }
 var b4 = &[16]byte { 4: 1, 1, 1, 1, 12: 1, 1, }
@@ -33,7 +33,7 @@ var a5 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, }
 var b5 = &[16]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, }
 
 var a6 = &[16]byte { 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, }
-var b6 = &[...]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0,}       // throws index out of range
+var b6 = &[...]byte { 1, 4: 1, 1, 1, 1, 12: 1, 1, 0, 0,}
 
 type Same struct {
        a, b interface{}
index 8465dc5d7e41d0d0778d3ccfe32b6939c3487602..2700ba097b5e54a86f069db07dd3d8e3c0f036e8 100644 (file)
@@ -22,4 +22,4 @@ var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }     // ERROR "index"
 var a5 = []byte { x: 2 }       // ERROR "index"
 
 var ok1 = S { }        // should be ok
-var ok2 = T { S: a4 }  // should be ok
+var ok2 = T { S: ok1 } // should be ok