Node *l, *n, *r, **hash;
NodeList *ll;
Type *t, *f;
- Sym *s;
+ Sym *s, *s1;
int32 lno;
ulong nhash;
Node *autohash[101];
// 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 && exportname(s->name))
- s = lookup(s->name);
-
+ if(s->pkg != localpkg && exportname(s->name)) {
+ s1 = lookup(s->name);
+ if(s1->origpkg == s->pkg)
+ s = s1;
+ }
f = lookdot1(nil, s, t, t->type, 0);
if(f == nil) {
yyerror("unknown %T field '%S' in struct literal", t, s);
--- /dev/null
+// errorcheck
+
+// Copyright 2012 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 "os"
+
+type T struct {
+ File int
+}
+
+func main() {
+ _ = T {
+ os.File: 1, // ERROR "unknown T field"
+ }
+}