From: Russ Cox Date: Wed, 12 Aug 2009 22:58:31 +0000 (-0700) Subject: bug188 - sort(x) X-Git-Tag: weekly.2009-11-06~894 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3e98a407933c4f53ac825e927d152644b690ef92;p=gostls13.git bug188 - sort(x) R=ken OCL=33123 CL=33123 --- diff --git a/src/cmd/gc/typecheck.c b/src/cmd/gc/typecheck.c index 2ff2af9307..fba107f8b3 100644 --- a/src/cmd/gc/typecheck.c +++ b/src/cmd/gc/typecheck.c @@ -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) */ diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 2f5ff58325..b7d6d8e5e0 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -230,6 +230,10 @@ walkdef(Node *n) yyerror("embedded type cannot be a pointer"); } break; + + case OPACK: + // nothing to see here + break; } ret: diff --git a/test/fixedbugs/bug186.go b/test/fixedbugs/bug186.go index 97c094734d..a54934e2bd 100644 --- a/test/fixedbugs/bug186.go +++ b/test/fixedbugs/bug186.go @@ -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 index 0000000000..cbd421bb79 --- /dev/null +++ b/test/fixedbugs/bug188.go @@ -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" +}