aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/testdata/check/typeinst2.go2
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-08-09 10:53:43 -0700
committerRobert Griesemer <gri@golang.org>2021-08-10 01:20:34 +0000
commite4cfa2f6dad8c73e98a4149948ded424df9c8501 (patch)
tree1247e3badd9ef3e109a0daf7eaf1cefb18c6c434 /src/cmd/compile/internal/types2/testdata/check/typeinst2.go2
parent508624f359f168cab32814f63d29a4305fb01588 (diff)
downloadgo-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 'src/cmd/compile/internal/types2/testdata/check/typeinst2.go2')
-rw-r--r--src/cmd/compile/internal/types2/testdata/check/typeinst2.go214
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/check/typeinst2.go2 b/src/cmd/compile/internal/types2/testdata/check/typeinst2.go2
index e90e4dde44..d087c26a47 100644
--- a/src/cmd/compile/internal/types2/testdata/check/typeinst2.go2
+++ b/src/cmd/compile/internal/types2/testdata/check/typeinst2.go2
@@ -85,7 +85,7 @@ type NumericAbs[T any] interface {
Abs() T
}
-func AbsDifference[T NumericAbs[T]](x T)
+func AbsDifference[T NumericAbs[T]](x T) { panic(0) }
type OrderedAbs[T any] T
@@ -97,7 +97,7 @@ func OrderedAbsDifference[T any](x T) {
// same code, reduced to essence
-func g[P interface{ m() P }](x P)
+func g[P interface{ m() P }](x P) { panic(0) }
type T4[P any] P
@@ -205,7 +205,7 @@ type I0 interface {
E0
}
-func f0[T I0]()
+func f0[T I0]() {}
var _ = f0[int]
var _ = f0[bool]
var _ = f0[string]
@@ -216,7 +216,7 @@ type I01 interface {
E1
}
-func f01[T I01]()
+func f01[T I01]() {}
var _ = f01[int]
var _ = f01[bool /* ERROR does not satisfy I0 */ ]
var _ = f01[string]
@@ -228,7 +228,7 @@ type I012 interface {
E2
}
-func f012[T I012]()
+func f012[T I012]() {}
var _ = f012[int /* ERROR does not satisfy I012 */ ]
var _ = f012[bool /* ERROR does not satisfy I012 */ ]
var _ = f012[string /* ERROR does not satisfy I012 */ ]
@@ -239,7 +239,7 @@ type I12 interface {
E2
}
-func f12[T I12]()
+func f12[T I12]() {}
var _ = f12[int /* ERROR does not satisfy I12 */ ]
var _ = f12[bool /* ERROR does not satisfy I12 */ ]
var _ = f12[string /* ERROR does not satisfy I12 */ ]
@@ -250,7 +250,7 @@ type I0_ interface {
~int
}
-func f0_[T I0_]()
+func f0_[T I0_]() {}
var _ = f0_[int]
var _ = f0_[bool /* ERROR does not satisfy I0_ */ ]
var _ = f0_[string /* ERROR does not satisfy I0_ */ ]