Skip to content

Commit 00c0a3a

Browse files
committedJan 13, 2016
go/importer: revert incorrect change that slipped in prior CL
The package of anonymous fields is the package in which they were declared, not the package of the anonymous field's type. Was correct before and incorrectly changed with https://golang.org/cl/18549. Change-Id: I9fd5bfbe9d0498c8733b6ca7b134a85defe16113 Reviewed-on: https://go-review.googlesource.com/18596 Reviewed-by: Alan Donovan <[email protected]>
1 parent 4a0eee2 commit 00c0a3a

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed
 

‎src/go/internal/gcimporter/gcimporter.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -492,12 +492,10 @@ func (p *parser) parseField(parent *types.Package) (*types.Var, string) {
492492
// anonymous field - typ must be T or *T and T must be a type name
493493
switch typ := deref(typ).(type) {
494494
case *types.Basic: // basic types are named types
495-
pkg = nil
495+
pkg = nil // objects defined in Universe scope have no package
496496
name = typ.Name()
497497
case *types.Named:
498-
obj := typ.Obj()
499-
pkg = obj.Pkg()
500-
name = obj.Name()
498+
name = typ.Obj().Name()
501499
default:
502500
p.errorf("anonymous field expected")
503501
}

0 commit comments

Comments
 (0)
Please sign in to comment.