From e06b897351850a7b973cc3284937a45bcf090593 Mon Sep 17 00:00:00 2001 From: Robert Griesemer Date: Fri, 2 Aug 2013 09:33:37 -0700 Subject: [PATCH] go.tools/go/types: mark imported named types as 'complete' Fixes "illegal cycle" error for: go tool vet -v pkg/unicode. R=adonovan CC=golang-dev https://golang.org/cl/12355043 --- go/types/gcimporter.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go/types/gcimporter.go b/go/types/gcimporter.go index 99ab146d..f4b70d0a 100644 --- a/go/types/gcimporter.go +++ b/go/types/gcimporter.go @@ -159,6 +159,12 @@ func GcImport(imports map[string]*Package, path string) (pkg *Package, err error // ---------------------------------------------------------------------------- // gcParser +// TODO(gri) Imported objects don't have position information. +// Ideally use the debug table line info; alternatively +// create some fake position (or the position of the +// import). That way error messages referring to imported +// objects can print meaningful information. + // gcParser parses the exports inside a gc compiler-produced // object/archive file and populates its scope with the results. type gcParser struct { @@ -853,6 +859,7 @@ func (p *gcParser) parseTypeDecl() { if name := obj.typ.(*Named); name.underlying == nil { name.underlying = typ + name.complete = true } }