mirror of
https://github.com/golang/go
synced 2024-11-22 06:34:40 -07:00
bug161, fixed
R=ken OCL=29907 CL=29907
This commit is contained in:
parent
4019259411
commit
2f2577a4f6
@ -956,6 +956,8 @@ addvar(Node *n, Type *t, int ctxt)
|
|||||||
s->vargen = gen;
|
s->vargen = gen;
|
||||||
s->oname = n;
|
s->oname = n;
|
||||||
s->offset = 0;
|
s->offset = 0;
|
||||||
|
s->oconst = nil;
|
||||||
|
s->otype = nil;
|
||||||
s->lexical = LNAME;
|
s->lexical = LNAME;
|
||||||
|
|
||||||
n->funcdepth = funcdepth;
|
n->funcdepth = funcdepth;
|
||||||
@ -1003,6 +1005,8 @@ addtyp(Type *n, int ctxt)
|
|||||||
|
|
||||||
redeclare("type", s);
|
redeclare("type", s);
|
||||||
s->otype = n;
|
s->otype = n;
|
||||||
|
s->oconst = nil;
|
||||||
|
s->oname = nil;
|
||||||
s->lexical = LATYPE;
|
s->lexical = LATYPE;
|
||||||
|
|
||||||
d = dcl();
|
d = dcl();
|
||||||
@ -1056,6 +1060,8 @@ addconst(Node *n, Node *e, int ctxt)
|
|||||||
|
|
||||||
redeclare("constant", s);
|
redeclare("constant", s);
|
||||||
s->oconst = e;
|
s->oconst = e;
|
||||||
|
s->otype = nil;
|
||||||
|
s->oname = nil;
|
||||||
s->lexical = LNAME;
|
s->lexical = LNAME;
|
||||||
|
|
||||||
d = dcl();
|
d = dcl();
|
||||||
|
@ -1045,7 +1045,7 @@ Tpretty(Fmt *fp, Type *t)
|
|||||||
else
|
else
|
||||||
fmtprint(fp, "%lS", s);
|
fmtprint(fp, "%lS", s);
|
||||||
if(strcmp(s->package, package) == 0)
|
if(strcmp(s->package, package) == 0)
|
||||||
if(s->otype != t || (!s->export && !s->imported)) {
|
if((s->otype != t || !s->export) && !s->imported) {
|
||||||
fmtprint(fp, "·%s", filename);
|
fmtprint(fp, "·%s", filename);
|
||||||
if(t->vargen)
|
if(t->vargen)
|
||||||
fmtprint(fp, "·%d", t->vargen);
|
fmtprint(fp, "·%d", t->vargen);
|
||||||
|
17
test/fixedbugs/bug161.go
Normal file
17
test/fixedbugs/bug161.go
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// $G $D/$F.go || echo BUG: should compile
|
||||||
|
|
||||||
|
// 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 P
|
||||||
|
|
||||||
|
const a = 0;
|
||||||
|
|
||||||
|
func f(a int) {
|
||||||
|
a = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bug161.go:8: operation LITERAL not allowed in assignment context
|
||||||
|
*/
|
Loading…
Reference in New Issue
Block a user