1
0
mirror of https://github.com/golang/go synced 2024-11-23 01:20:02 -07:00

go/types, types2: fix Hilbert test for stand-alone run

When run as a stand-alone test (without other tests running before),
the builtin function 'assert' (only available for testing) is missing.
Make sure it's declared.

This change only affects this test, when run stand-alone, as in:

go test -run Hilbert

Fixes #60774.

Change-Id: Ib07d97ba2670b839e8ad11ef50d0e6581bb3d79d
Reviewed-on: https://go-review.googlesource.com/c/go/+/502996
Auto-Submit: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
This commit is contained in:
Robert Griesemer 2023-06-13 13:43:21 -07:00 committed by Gopher Robot
parent 9efa625d84
commit dac75b6675
3 changed files with 7 additions and 1 deletions

View File

@ -10,6 +10,8 @@ import (
"fmt"
"os"
"testing"
. "cmd/compile/internal/types2"
)
var (
@ -25,6 +27,7 @@ func TestHilbert(t *testing.T) {
return
}
DefPredeclaredTestFuncs() // declare assert (used by code generated by verify)
mustTypecheck(string(src), nil, nil)
}

View File

@ -102,7 +102,7 @@ var filemap = map[string]action{
"context.go": nil,
"context_test.go": nil,
"gccgosizes.go": nil,
"hilbert_test.go": nil,
"hilbert_test.go": func(f *ast.File) { renameImportPath(f, `"cmd/compile/internal/types2"`, `"go/types"`) },
"infer.go": func(f *ast.File) {
fixTokenPos(f)
fixInferSig(f)

View File

@ -12,6 +12,8 @@ import (
"fmt"
"os"
"testing"
. "go/types"
)
var (
@ -27,6 +29,7 @@ func TestHilbert(t *testing.T) {
return
}
DefPredeclaredTestFuncs() // declare assert (used by code generated by verify)
mustTypecheck(string(src), nil, nil)
}