]> Cypherpunks repositories - gostls13.git/commitdiff
bug189
authorRuss Cox <rsc@golang.org>
Mon, 24 Aug 2009 16:23:04 +0000 (09:23 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 24 Aug 2009 16:23:04 +0000 (09:23 -0700)
R=ken
OCL=33745
CL=33745

src/cmd/gc/typecheck.c
test/fixedbugs/bug189.go [moved from test/bugs/bug189.go with 81% similarity]
test/golden.out

index 8c76ebb8371aafb664a35761b880210b5f42d9d2..bca203ee643798290713125673c0655a8896edcd 100644 (file)
@@ -1608,6 +1608,8 @@ typecheckcomplit(Node **np)
                                ll->n->left->typecheck = 1;
                                f = f->down;
                        }
+                       if(f != nil)
+                               yyerror("too few values in struct initializer");
                } else {
                        // keyed list
                        for(ll=n->list; ll; ll=ll->next) {
similarity index 81%
rename from test/bugs/bug189.go
rename to test/fixedbugs/bug189.go
index 3befe82f699c2f803c4c672f59b92fa06d3bda90..d585ac463d733b4e45fc05b61717c871b3e3b68f 100644 (file)
@@ -13,5 +13,5 @@ type S struct {
 func main() {
        s1 := S{a: 7};  // ok - field is named
        s3 := S{7, 11}; // ok - all fields have values
-       s2 := S{7};     // bug - should not compile since not all fields have values
+       s2 := S{7};     // ERROR "too few"
 }
index c1a6092e678ee7febdd6f1ccc58ccd8371d655c7..f3d59679ba3ed2d35442060fd27f9ff4aecf387a 100644 (file)
@@ -157,9 +157,6 @@ BUG: errchk: command succeeded unexpectedly
 =========== bugs/bug187.go
 BUG: 0 1
 
-=========== bugs/bug189.go
-BUG: errchk: command succeeded unexpectedly
-
 =========== bugs/bug190.go
 bugs/bug190.go:11: invalid recursive type []S
 bugs/bug190.go:16: invalid recursive type S