p.paramList(m.Type.Results(), false)
}
-// fieldName is like qualifiedName but it doesn't record the package
-// for blank (_) or exported names.
+// fieldName is like qualifiedName but it doesn't record the package for exported names.
func (p *exporter) fieldName(t *Field) {
name := t.Sym.Name
-
if t.Embedded != 0 {
name = "" // anonymous field
if bname := basetypeName(t.Type); bname != "" && !exportname(bname) {
}
}
p.string(name)
-
- if name != "_" && name != "" && !exportname(name) {
+ if name != "" && !exportname(name) {
p.pkg(t.Sym.Pkg)
}
}
func (p *importer) fieldName() *Sym {
name := p.string()
pkg := localpkg
- if name == "_" {
- // During imports, unqualified non-exported identifiers are from builtinpkg
- // (see parser.go:sym). The binary exporter only exports blank as a non-exported
- // identifier without qualification.
- pkg = builtinpkg
- } else if name != "" && !exportname(name) {
+ if name != "" && !exportname(name) {
if name == "?" {
name = ""
}
}
func (p *importer) fieldName(parent *types.Package) (*types.Package, string) {
+ name := p.string()
pkg := parent
if pkg == nil {
// use the imported package instead
pkg = p.pkgList[0]
}
- name := p.string()
- if name == "" {
- return pkg, "" // anonymous
- }
- if name == "?" || name != "_" && !exported(name) {
- // explicitly qualified field
+ if name != "" && !exported(name) {
if name == "?" {
- name = "" // anonymous
+ name = ""
}
pkg = p.pkg()
}
--- /dev/null
+// Copyright 2016 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
+
+type A struct{ _ int32 }
--- /dev/null
+// Copyright 2016 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
+
+func B() (_ struct{ _ int32 }) { return }
--- /dev/null
+// Copyright 2016 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 c
+
+import "./a"
+import "./b"
+
+var _ a.A = b.B() // ERROR "cannot use b\.B"
--- /dev/null
+// errorcheckdir
+
+// Copyright 2016 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 ignored