diff options
author | Robert Griesemer <gri@golang.org> | 2021-07-09 13:02:24 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-07-13 04:40:11 +0000 |
commit | 22e926546732e4ea1fb20551be4b91f51f3b6e65 (patch) | |
tree | d2f775b15c81044b86dda4a0cc119255daefecd3 /src/cmd/compile/internal/types2/api_test.go | |
parent | 1c783dc1480e8dec8bd4e76b744238607ea527f0 (diff) | |
download | go-22e926546732e4ea1fb20551be4b91f51f3b6e65.tar.gz go-22e926546732e4ea1fb20551be4b91f51f3b6e65.zip |
[dev.typeparams] cmd/compile/internal/types2: replace types2.Instantiate with Checker.Instantiate
Allow Checker.Instantiate to work with a nil *Checker receiver
(for now). This opens the door to passing in a *Checker at all
times.
Also, added a verify flag to Instantiate, InstantiateLazy, and
instance, to be able to control if constraint satisfaction should
be checked or not.
Removed types2.Instantiate.
For #47103.
Change-Id: Ie00ce41b3e50a0fc4341e013922e5f874276d282
Reviewed-on: https://go-review.googlesource.com/c/go/+/333569
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/api_test.go')
-rw-r--r-- | src/cmd/compile/internal/types2/api_test.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/api_test.go b/src/cmd/compile/internal/types2/api_test.go index 1c535387d4..74e3da3fe1 100644 --- a/src/cmd/compile/internal/types2/api_test.go +++ b/src/cmd/compile/internal/types2/api_test.go @@ -1862,7 +1862,9 @@ func TestInstantiate(t *testing.T) { } // instantiation should succeed (no endless recursion) - res := Instantiate(nopos, T, []Type{Typ[Int]}) + // even with a nil *Checker + var check *Checker + res := check.Instantiate(nopos, T, []Type{Typ[Int]}, nil, false) // instantiated type should point to itself if res.Underlying().(*Pointer).Elem() != res { |