mirror of
https://github.com/golang/go
synced 2024-11-22 22:00:02 -07:00
go/types, types2: make sure info recording is executed in test runs
Issue #61486 causes a compiler crash but is not detected when running stand-alone type-checker tests because no types are recorded. Set up Config.Info map with all maps when when running local tests so that type/object recording code is executed during local tests. For #61486. Change-Id: I8eb40c8525dac3da65db0dc7e0e654842713b9a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/511657 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Reviewed-by: Alan Donovan <adonovan@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
57e2eb64eb
commit
7b625d1f65
@ -163,7 +163,17 @@ func testFiles(t *testing.T, filenames []string, srcs [][]byte, colDelta uint, m
|
||||
opt(&conf)
|
||||
}
|
||||
|
||||
conf.Check(pkgName, files, nil)
|
||||
// Provide Config.Info with all maps so that info recording is tested.
|
||||
info := Info{
|
||||
Types: make(map[syntax.Expr]TypeAndValue),
|
||||
Instances: make(map[*syntax.Name]Instance),
|
||||
Defs: make(map[*syntax.Name]Object),
|
||||
Uses: make(map[*syntax.Name]Object),
|
||||
Implicits: make(map[syntax.Node]Object),
|
||||
Selections: make(map[*syntax.SelectorExpr]*Selection),
|
||||
Scopes: make(map[syntax.Node]*Scope),
|
||||
}
|
||||
conf.Check(pkgName, files, &info)
|
||||
|
||||
if listErrors {
|
||||
return
|
||||
|
@ -178,7 +178,17 @@ func testFiles(t *testing.T, filenames []string, srcs [][]byte, manual bool, opt
|
||||
opt(&conf)
|
||||
}
|
||||
|
||||
conf.Check(pkgName, fset, files, nil)
|
||||
// Provide Config.Info with all maps so that info recording is tested.
|
||||
info := Info{
|
||||
Types: make(map[ast.Expr]TypeAndValue),
|
||||
Instances: make(map[*ast.Ident]Instance),
|
||||
Defs: make(map[*ast.Ident]Object),
|
||||
Uses: make(map[*ast.Ident]Object),
|
||||
Implicits: make(map[ast.Node]Object),
|
||||
Selections: make(map[*ast.SelectorExpr]*Selection),
|
||||
Scopes: make(map[ast.Node]*Scope),
|
||||
}
|
||||
conf.Check(pkgName, fset, files, &info)
|
||||
|
||||
if listErrors {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user