mirror of
https://github.com/golang/go
synced 2024-11-25 07:07:57 -07:00
go/types, types2: follow-up on comment in CL 615195
Restate deferred call for readability. Change-Id: I3725535b18fa4f1887e6c1976f8784e092b8f965 Reviewed-on: https://go-review.googlesource.com/c/go/+/615535 Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Tim King <taking@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
parent
2f24fdde4e
commit
03fecda02b
@ -182,7 +182,8 @@ func testFilesImpl(t *testing.T, filenames []string, srcs [][]byte, colDelta uin
|
||||
}
|
||||
|
||||
if goexperiment != "" {
|
||||
defer setGOEXPERIMENT(goexperiment)()
|
||||
revert := setGOEXPERIMENT(goexperiment)
|
||||
defer revert()
|
||||
}
|
||||
|
||||
// By default, gotypesalias is not set.
|
||||
@ -329,9 +330,7 @@ func setGOEXPERIMENT(goexperiment string) func() {
|
||||
}
|
||||
old := buildcfg.Experiment
|
||||
buildcfg.Experiment = *exp
|
||||
return func() {
|
||||
buildcfg.Experiment = old
|
||||
}
|
||||
return func() { buildcfg.Experiment = old }
|
||||
}
|
||||
|
||||
// TestManual is for manual testing of a package - either provided
|
||||
|
@ -115,7 +115,8 @@ func TestObjectString(t *testing.T) {
|
||||
for i, test := range testObjects {
|
||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||
if test.alias {
|
||||
defer setGOEXPERIMENT("aliastypeparams")()
|
||||
revert := setGOEXPERIMENT("aliastypeparams")
|
||||
defer revert()
|
||||
}
|
||||
src := "package p; " + test.src
|
||||
conf := Config{Error: func(error) {}, Importer: defaultImporter(), EnableAlias: test.alias}
|
||||
|
@ -197,7 +197,8 @@ func testFilesImpl(t *testing.T, filenames []string, srcs [][]byte, manual bool,
|
||||
}
|
||||
|
||||
if goexperiment != "" {
|
||||
defer setGOEXPERIMENT(goexperiment)()
|
||||
revert := setGOEXPERIMENT(goexperiment)
|
||||
defer revert()
|
||||
}
|
||||
|
||||
// By default, gotypesalias is not set.
|
||||
@ -357,9 +358,7 @@ func setGOEXPERIMENT(goexperiment string) func() {
|
||||
}
|
||||
old := buildcfg.Experiment
|
||||
buildcfg.Experiment = *exp
|
||||
return func() {
|
||||
buildcfg.Experiment = old
|
||||
}
|
||||
return func() { buildcfg.Experiment = old }
|
||||
}
|
||||
|
||||
// TestManual is for manual testing of a package - either provided
|
||||
|
@ -115,7 +115,8 @@ func TestObjectString(t *testing.T) {
|
||||
for i, test := range testObjects {
|
||||
t.Run(fmt.Sprint(i), func(t *testing.T) {
|
||||
if test.alias {
|
||||
defer setGOEXPERIMENT("aliastypeparams")()
|
||||
revert := setGOEXPERIMENT("aliastypeparams")
|
||||
defer revert()
|
||||
t.Setenv("GODEBUG", "gotypesalias=1")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user