1
0
mirror of https://github.com/golang/go synced 2024-11-17 20:54:48 -07:00

go/types, types2: simplify test setup in a couple of places (cleanup)

Change-Id: I4e7a0ffad49f1c3b50520648d66f18dd4c9bde55
Reviewed-on: https://go-review.googlesource.com/c/go/+/443779
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
Robert Griesemer 2022-10-18 13:33:32 -07:00 committed by Gopher Robot
parent 8265683dda
commit 35e54da996
2 changed files with 4 additions and 28 deletions

View File

@ -46,14 +46,8 @@ var (
_ = (interface{})("foo")
_ = (interface{})(nil)
)`
f := mustParse(t, src)
var conf Config
types := make(map[syntax.Expr]TypeAndValue)
_, err := conf.Check(f.PkgName.Value, []*syntax.File{f}, &Info{Types: types})
if err != nil {
t.Fatal(err)
}
mustTypecheck(t, "p", src, &Info{Types: types})
for x, tv := range types {
var want Type
@ -91,14 +85,8 @@ func f() int {
return 0
}
`
f := mustParse(t, src)
var conf Config
types := make(map[syntax.Expr]TypeAndValue)
_, err := conf.Check(f.PkgName.Value, []*syntax.File{f}, &Info{Types: types})
if err != nil {
t.Fatal(err)
}
mustTypecheck(t, "p", src, &Info{Types: types})
want := Typ[Int]
n := 0

View File

@ -49,14 +49,8 @@ var (
_ = (interface{})("foo")
_ = (interface{})(nil)
)`
f := mustParse(t, src)
var conf Config
types := make(map[ast.Expr]TypeAndValue)
_, err := conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Types: types})
if err != nil {
t.Fatal(err)
}
mustTypecheck(t, "p", src, &Info{Types: types})
for x, tv := range types {
var want Type
@ -94,14 +88,8 @@ func f() int {
return 0
}
`
f := mustParse(t, src)
var conf Config
types := make(map[ast.Expr]TypeAndValue)
_, err := conf.Check(f.Name.Name, fset, []*ast.File{f}, &Info{Types: types})
if err != nil {
t.Fatal(err)
}
mustTypecheck(t, "p", src, &Info{Types: types})
want := Typ[Int]
n := 0