Skip to content

Commit a68386b

Browse files
committed
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 <[email protected]> Reviewed-by: Daniel Martí <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 1cd2f21 commit a68386b

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

go/packages/packages.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ const (
8888

8989
// LoadTypes adds type information for package-level
9090
// declarations in the packages matching the patterns.
91-
// Package fields added: Types, Fset, and IllTyped.
91+
// Package fields added: Types, TypesSizes, Fset, and IllTyped.
9292
// This mode uses type information provided by the build system when
9393
// possible, and may fill in the ExportFile field.
94-
LoadTypes = LoadImports | NeedTypes
94+
LoadTypes = LoadImports | NeedTypes | NeedTypesSizes
9595

9696
// LoadSyntax adds typed syntax trees for the packages matching the patterns.
9797
// Package fields added: Syntax, and TypesInfo, for direct pattern matches only.
98-
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo | NeedTypesSizes
98+
LoadSyntax = LoadTypes | NeedSyntax | NeedTypesInfo
9999

100100
// LoadAllSyntax adds typed syntax trees for the packages matching the patterns
101101
// and all dependencies.

go/packages/packages_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,8 @@ func testLoadTypes(t *testing.T, exporter packagestest.Exporter) {
569569
continue
570570
} else if !p.Types.Complete() {
571571
t.Errorf("incomplete types.Package for %s", p)
572+
} else if p.TypesSizes == nil {
573+
t.Errorf("TypesSizes is not filled in for %s", p)
572574
}
573575

574576
}

0 commit comments

Comments
 (0)