diff options
author | Robert Griesemer <gri@golang.org> | 2021-08-09 10:53:43 -0700 |
---|---|---|
committer | Robert Griesemer <gri@golang.org> | 2021-08-10 01:20:34 +0000 |
commit | e4cfa2f6dad8c73e98a4149948ded424df9c8501 (patch) | |
tree | 1247e3badd9ef3e109a0daf7eaf1cefb18c6c434 /test/typeparam/smoketest.go | |
parent | 508624f359f168cab32814f63d29a4305fb01588 (diff) | |
download | go-e4cfa2f6dad8c73e98a4149948ded424df9c8501.tar.gz go-e4cfa2f6dad8c73e98a4149948ded424df9c8501.zip |
[dev.typeparams] cmd/compile/internal/types2: parameterized functions must have a body
Add the respective check and add missing bodies to tests.
Use {} as body for functions that don't return a result.
Use { panic(0) } as body for functions that return a result.
For #47069.
Change-Id: Ia5d7525c9c036baf8a955d13bff448401e08235e
Reviewed-on: https://go-review.googlesource.com/c/go/+/340911
Trust: Robert Griesemer <gri@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'test/typeparam/smoketest.go')
-rw-r--r-- | test/typeparam/smoketest.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/typeparam/smoketest.go b/test/typeparam/smoketest.go index eeda25964f..5243dc5c3c 100644 --- a/test/typeparam/smoketest.go +++ b/test/typeparam/smoketest.go @@ -9,9 +9,9 @@ package smoketest // type parameters for functions -func f1[P any]() -func f2[P1, P2 any, P3 any]() -func f3[P interface{}](x P, y T1[int]) +func f1[P any]() {} +func f2[P1, P2 any, P3 any]() {} +func f3[P interface{}](x P, y T1[int]) {} // function instantiations var _ = f1[int] |