go/packages: add NeedTypesSizes to LoadTypes

This change moves the NeedTypesSizes bit to LoadTypes instead of LoadSyntax.

Fixes golang/go#31163

Change-Id: Icaf16639202533fbb2190756a325b36d8ac9251c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/170016
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2019-03-30 12:19:12 -04:00
parent 1cd2f21070
commit a68386b9ff
2 changed files with 5 additions and 3 deletions

View File

@ -88,14 +88,14 @@ const (
// LoadTypes adds type information for package-level // LoadTypes adds type information for package-level
// declarations in the packages matching the patterns. // declarations in the packages matching the patterns.
// Package fields added: Types, Fset, and IllTyped. // Package fields added: Types, TypesSizes, Fset, and IllTyped.
// This mode uses type information provided by the build system when // This mode uses type information provided by the build system when
// possible, and may fill in the ExportFile field. // possible, and may fill in the ExportFile field.
LoadTypes = LoadImports | NeedTypes LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
// LoadSyntax adds typed syntax trees for the packages matching the patterns. // LoadSyntax adds typed syntax trees for the packages matching the patterns.
// Package fields added: Syntax, and TypesInfo, for direct pattern matches only. // Package fields added: Syntax, and TypesInfo, for direct pattern matches only.
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo | NeedTypesSizes LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
// LoadAllSyntax adds typed syntax trees for the packages matching the patterns // LoadAllSyntax adds typed syntax trees for the packages matching the patterns
// and all dependencies. // and all dependencies.

View File

@ -569,6 +569,8 @@ func testLoadTypes(t *testing.T, exporter packagestest.Exporter) {
continue continue
} else if !p.Types.Complete() { } else if !p.Types.Complete() {
t.Errorf("incomplete types.Package for %s", p) t.Errorf("incomplete types.Package for %s", p)
} else if p.TypesSizes == nil {
t.Errorf("TypesSizes is not filled in for %s", p)
} }
} }