mirror of
https://github.com/golang/go
synced 2024-11-05 18:36:08 +00:00
catch
a := true; a |= a; in the front end. R=ken OCL=32240 CL=32243
This commit is contained in:
parent
0b2683d1ee
commit
03b25a92a3
2 changed files with 21 additions and 3 deletions
|
@ -338,7 +338,7 @@ walkexpr(Node *n, int top, NodeList **init)
|
||||||
NodeList *ll, *lr;
|
NodeList *ll, *lr;
|
||||||
Type *t;
|
Type *t;
|
||||||
Sym *s;
|
Sym *s;
|
||||||
int et, cl, cr, typeok;
|
int et, cl, cr, typeok, op;
|
||||||
int32 lno;
|
int32 lno;
|
||||||
|
|
||||||
if(n == N)
|
if(n == N)
|
||||||
|
@ -1252,7 +1252,10 @@ reswitch:
|
||||||
* ======== second switch ========
|
* ======== second switch ========
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(n->op) {
|
op = n->op;
|
||||||
|
if(op == OASOP)
|
||||||
|
op = n->etype;
|
||||||
|
switch(op) {
|
||||||
default:
|
default:
|
||||||
fatal("walkexpr: switch 2 unknown op %N", n, init);
|
fatal("walkexpr: switch 2 unknown op %N", n, init);
|
||||||
goto ret;
|
goto ret;
|
||||||
|
@ -1423,7 +1426,10 @@ badt:
|
||||||
badtype(n->op, n->left->type, T);
|
badtype(n->op, n->left->type, T);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
badtype(n->op, n->left->type, n->right->type);
|
op = n->op;
|
||||||
|
if(op == OASOP)
|
||||||
|
op = n->etype;
|
||||||
|
badtype(op, n->left->type, n->right->type);
|
||||||
goto ret;
|
goto ret;
|
||||||
|
|
||||||
ret:
|
ret:
|
||||||
|
|
12
test/fixedbugs/bug172.go
Normal file
12
test/fixedbugs/bug172.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// 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
|
||||||
|
|
||||||
|
func f() {
|
||||||
|
a := true;
|
||||||
|
a |= a; // ERROR "illegal.*OR"
|
||||||
|
}
|
Loading…
Reference in a new issue