mirror of
https://github.com/golang/go
synced 2024-11-22 00:44:39 -07:00
gc: import dot shadowing bug
R=ken2 CC=golang-dev https://golang.org/cl/1873047
This commit is contained in:
parent
ad4f95d365
commit
7b240e8135
@ -1781,6 +1781,11 @@ typecheckcomplit(Node **np)
|
||||
typecheck(&l->right, Erv);
|
||||
continue;
|
||||
}
|
||||
// Sym might have resolved to name in other top-level
|
||||
// package, because of import dot. Redirect to correct sym
|
||||
// before we do the lookup.
|
||||
if(s->pkg != localpkg)
|
||||
s = lookup(s->name);
|
||||
l->left = newname(s);
|
||||
l->left->typecheck = 1;
|
||||
f = lookdot1(s, t, t->type, 0);
|
||||
|
17
test/fixedbugs/bug295.go
Normal file
17
test/fixedbugs/bug295.go
Normal file
@ -0,0 +1,17 @@
|
||||
// $G $D/$F.go && $L $F.$A && ./$A.out
|
||||
|
||||
// Copyright 2010 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
|
||||
|
||||
import . "testing" // defines top-level T
|
||||
|
||||
type S struct {
|
||||
T int
|
||||
}
|
||||
|
||||
func main() {
|
||||
_ = &S{T: 1} // should work
|
||||
}
|
Loading…
Reference in New Issue
Block a user