bind: fix build broken by API change to golang.org/x/tools/go/types
Fixes golang/go#11509. Change-Id: Ia54febfa3ef9b589befb09b8f5d79cb6d7f6c4da Reviewed-on: https://go-review.googlesource.com/11841 Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
bd8fa0d7bb
commit
616f82b347
@ -373,7 +373,7 @@ func (g *goGen) typeString(typ types.Type) string {
|
||||
case *types.Named:
|
||||
obj := t.Obj()
|
||||
if obj.Pkg() == nil { // e.g. error type is *types.Named.
|
||||
return types.TypeString(pkg, typ)
|
||||
return types.TypeString(typ, types.RelativeTo(pkg))
|
||||
}
|
||||
if obj.Pkg() != g.pkg {
|
||||
g.errorf("type %s not defined in package %s", t, g.pkg)
|
||||
@ -381,7 +381,7 @@ func (g *goGen) typeString(typ types.Type) string {
|
||||
|
||||
switch t.Underlying().(type) {
|
||||
case *types.Interface, *types.Struct:
|
||||
return fmt.Sprintf("%s.%s", pkg.Name(), types.TypeString(pkg, typ))
|
||||
return fmt.Sprintf("%s.%s", pkg.Name(), types.TypeString(typ, types.RelativeTo(pkg)))
|
||||
default:
|
||||
g.errorf("unsupported named type %s / %T", t, t)
|
||||
}
|
||||
@ -393,7 +393,7 @@ func (g *goGen) typeString(typ types.Type) string {
|
||||
g.errorf("not yet supported, pointer type %s / %T", t, t)
|
||||
}
|
||||
default:
|
||||
return types.TypeString(pkg, typ)
|
||||
return types.TypeString(typ, types.RelativeTo(pkg))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user