]> Cypherpunks repositories - gostls13.git/commitdiff
bug188 - sort(x)
authorRuss Cox <rsc@golang.org>
Wed, 12 Aug 2009 22:58:31 +0000 (15:58 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 12 Aug 2009 22:58:31 +0000 (15:58 -0700)
R=ken
OCL=33123
CL=33123

src/cmd/gc/typecheck.c
src/cmd/gc/walk.c
test/fixedbugs/bug186.go
test/fixedbugs/bug188.go [new file with mode: 0644]

index 2ff2af9307b0c0b271ecb3110ff5eb366db4978e..fba107f8b3d4a5cfc1fa60e9c6efa9f736d873b8 100644 (file)
@@ -86,7 +86,7 @@ reswitch:
        case OLITERAL:
                ok |= Erv;
                if(n->iota && !(top & Eiota))
-                       yyerror("use of iota outside of constant initializer");
+                       yyerror("use of iota not in constant initializer");
                goto ret;
 
        case ONONAME:
@@ -101,6 +101,10 @@ reswitch:
                ok |= Erv;
                goto ret;
 
+       case OPACK:
+               yyerror("use of package %S not in selector", n->sym);
+               goto error;
+
        /*
         * types (OIND is with exprs)
         */
index 2f5ff58325d2a955389eb064bd9a0e4588137fc7..b7d6d8e5e08bbae2360d151e24cc7a3df17475f7 100644 (file)
@@ -230,6 +230,10 @@ walkdef(Node *n)
                                yyerror("embedded type cannot be a pointer");
                }
                break;
+
+       case OPACK:
+               // nothing to see here
+               break;
        }
 
 ret:
index 97c094734d830157382d4a9ec43f63a9e4d42305..a54934e2bd2f2a5ca81bb2a51c7a91937bcf1c4a 100644 (file)
@@ -12,7 +12,7 @@ func f(x int) { }
 
 func main() {
        f(X);
-       f(iota);        // ERROR "iota.*outside.*initializer"
+       f(iota);        // ERROR "iota.*initializer"
        f(X);
-       f(iota);        // ERROR "iota.*outside.*initializer"
+       f(iota);        // ERROR "iota.*initializer"
 }
diff --git a/test/fixedbugs/bug188.go b/test/fixedbugs/bug188.go
new file mode 100644 (file)
index 0000000..cbd421b
--- /dev/null
@@ -0,0 +1,14 @@
+// errchk $G $D/$F.go
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "sort"
+
+func main() {
+       var x int;
+       sort(x);        // ERROR "package.*selector"
+}