mirror of
https://github.com/golang/go
synced 2024-11-22 03:44:39 -07:00
gc: fix import width bug
Fixes #1705. R=ken2 CC=golang-dev https://golang.org/cl/4443060
This commit is contained in:
parent
883d68f885
commit
3a1fdc655e
@ -43,6 +43,8 @@ cgen(Node *n, Node *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isfat(n->type)) {
|
if(isfat(n->type)) {
|
||||||
|
if(n->type->width < 0)
|
||||||
|
fatal("forgot to compute width for %T", n->type);
|
||||||
sgen(n, res, n->type->width);
|
sgen(n, res, n->type->width);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,8 @@ cgen(Node *n, Node *res)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isfat(n->type)) {
|
if(isfat(n->type)) {
|
||||||
|
if(n->type->width < 0)
|
||||||
|
fatal("forgot to compute width for %T", n->type);
|
||||||
sgen(n, res, n->type->width);
|
sgen(n, res, n->type->width);
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,8 @@ cgen(Node *n, Node *res)
|
|||||||
|
|
||||||
// structs etc get handled specially
|
// structs etc get handled specially
|
||||||
if(isfat(n->type)) {
|
if(isfat(n->type)) {
|
||||||
|
if(n->type->width < 0)
|
||||||
|
fatal("forgot to compute width for %T", n->type);
|
||||||
sgen(n, res, n->type->width);
|
sgen(n, res, n->type->width);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -684,6 +684,10 @@ ok:
|
|||||||
pt->nod = n;
|
pt->nod = n;
|
||||||
pt->sym = n->sym;
|
pt->sym = n->sym;
|
||||||
pt->sym->lastlineno = parserline();
|
pt->sym->lastlineno = parserline();
|
||||||
|
pt->siggen = 0;
|
||||||
|
pt->printed = 0;
|
||||||
|
pt->deferwidth = 0;
|
||||||
|
pt->local = 0;
|
||||||
declare(n, PEXTERN);
|
declare(n, PEXTERN);
|
||||||
|
|
||||||
checkwidth(pt);
|
checkwidth(pt);
|
||||||
|
@ -142,7 +142,9 @@ walkdeftype(Node *n)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// copy new type and clear fields
|
// copy new type and clear fields
|
||||||
// that don't come along
|
// that don't come along.
|
||||||
|
// anything zeroed here must be zeroed in
|
||||||
|
// typedcl2 too.
|
||||||
maplineno = n->type->maplineno;
|
maplineno = n->type->maplineno;
|
||||||
embedlineno = n->type->embedlineno;
|
embedlineno = n->type->embedlineno;
|
||||||
*n->type = *t;
|
*n->type = *t;
|
||||||
|
9
test/fixedbugs/bug335.dir/a.go
Normal file
9
test/fixedbugs/bug335.dir/a.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
// Copyright 2011 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 a
|
||||||
|
|
||||||
|
import "./b"
|
||||||
|
|
||||||
|
var Bar = b.Foo
|
11
test/fixedbugs/bug335.dir/b.go
Normal file
11
test/fixedbugs/bug335.dir/b.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright 2011 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 b
|
||||||
|
|
||||||
|
type T interface{}
|
||||||
|
|
||||||
|
func f() T { return nil }
|
||||||
|
|
||||||
|
var Foo T = f()
|
10
test/fixedbugs/bug335.go
Normal file
10
test/fixedbugs/bug335.go
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go
|
||||||
|
// rm -f a.$A b.$A
|
||||||
|
|
||||||
|
// Copyright 2011 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.
|
||||||
|
|
||||||
|
// Issue 1705.
|
||||||
|
|
||||||
|
unused (see script at top of file)
|
Loading…
Reference in New Issue
Block a user