as a new name in a later declaration
(bug 144)
R=r
OCL=27850
CL=27850
| laconst
{
$$ = nod(OLITERAL, N, N);
+ $$->sym = $1;
$$->val = $1->oconst->val;
$$->type = $1->oconst->type;
}
return n;
}
+int
+colasname(Node *n)
+{
+ switch(n->op) {
+ case ONAME:
+ case ONONAME:
+ break;
+ case OLITERAL:
+ if(n->sym != S)
+ break;
+ // fallthrough
+ default:
+ return 0;
+ }
+ return 1;
+}
+
Node*
old2new(Node *n, Type *t)
{
Node *l;
- if(n->op != ONAME && n->op != ONONAME) {
+ if(!colasname(n)) {
yyerror("left side of := must be a name");
return n;
}
t = l->type;
l = l->left;
- if(l->op != ONAME && l->op != ONONAME)
+ if(!colasname(l))
goto allnew;
if(l->sym->block == block) {
if(!eqtype(l->type, t, 0))
bugs/bug140.go:7: syntax error near L2
BUG should compile
-=========== bugs/bug144.go
-bugs/bug144.go:8: left side of := must be a name
-bugs/bug144.go:8: operation LITERAL not allowed in assignment context
-bugs/bug144.go:8: illegal types for operand: AS
- ideal
- int
-BUG should compile
-
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: constant -3 overflows uint