1
0
mirror of https://github.com/golang/go synced 2024-11-22 01:24:42 -07:00
R=ken
OCL=25075
CL=25075
This commit is contained in:
Russ Cox 2009-02-16 17:44:05 -08:00
parent aa35aee07c
commit d3d0c256be
4 changed files with 10 additions and 5 deletions

View File

@ -1233,6 +1233,9 @@ lexinit(void)
s->otype = t;
}
/* for walk to use in error messages */
types[TFUNC] = functype(N, N, N);
/* pick up the backend typedefs */
belexinit(LBASETYPE);

View File

@ -373,9 +373,12 @@ loop:
if(n->type != T)
goto ret;
walktype(n->left, Erv);
if(n->left == N)
goto ret;
walktype(n->left, Erv);
convlit(n->left, types[TFUNC]);
t = n->left->type;
if(t == T)
goto ret;
@ -472,6 +475,7 @@ loop:
if(cr == 1) {
// a,b,... = fn()
walktype(r, Erv);
convlit(r, types[TFUNC]);
l = ascompatet(n->op, &n->left, &r->type, 0);
if(l != N)
indir(n, list(r, reorder2(l)));
@ -3108,6 +3112,7 @@ multi:
case OCALLINTER:
case OCALL:
walktype(nr->left, Erv);
convlit(nr->left, types[TFUNC]);
t = nr->left->type;
if(t != T && t->etype == tptr)
t = t->type;

View File

@ -7,7 +7,7 @@
package main
const ( F = 1 )
func fn(i int) int {
if i == F() { // ERROR "function"
if i == F() { // ERROR "func"
return 0
}
return 1

View File

@ -143,9 +143,6 @@ BUG: should compile
=========== bugs/bug122.go
BUG: compilation succeeds incorrectly
=========== bugs/bug123.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug123.go
=========== bugs/bug125.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go