1
0
mirror of https://github.com/golang/go synced 2024-09-24 01:20:13 -06:00

bug188 - sort(x)

R=ken
OCL=33123
CL=33123
This commit is contained in:
Russ Cox 2009-08-12 15:58:31 -07:00
parent 7dbb687048
commit 3e98a40793
4 changed files with 25 additions and 3 deletions

View 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)
*/

View File

@ -230,6 +230,10 @@ walkdef(Node *n)
yyerror("embedded type cannot be a pointer");
}
break;
case OPACK:
// nothing to see here
break;
}
ret:

View 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"
}

14
test/fixedbugs/bug188.go Normal file
View File

@ -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"
}