aboutsummaryrefslogtreecommitdiff
path: root/test/typeparam
diff options
context:
space:
mode:
authorRaghvender <raghvenders@gmail.com>2023-11-20 19:43:13 -0600
committerGopher Robot <gobot@golang.org>2023-12-08 00:50:55 +0000
commit4bf1ca4b0ce9a08f4c45d68fe49857914f668f69 (patch)
treedbd64063e1e85bf981164016a6d2ff987d447670 /test/typeparam
parent788a22775931ed6ca26426c5bf78ce3716b304ba (diff)
downloadgo-4bf1ca4b0ce9a08f4c45d68fe49857914f668f69.tar.gz
go-4bf1ca4b0ce9a08f4c45d68fe49857914f668f69.zip
cmd/compile: fix error message for mismatch between the number of type params and arguments
Fixes #64276 Change-Id: Ib6651669904e6ea0daf275d85d8bd008b8b21cc6 Reviewed-on: https://go-review.googlesource.com/c/go/+/544018 Reviewed-by: raghvender sundarjee <raghvenders@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'test/typeparam')
-rw-r--r--test/typeparam/issue51232.go10
-rw-r--r--test/typeparam/issue51233.go8
2 files changed, 9 insertions, 9 deletions
diff --git a/test/typeparam/issue51232.go b/test/typeparam/issue51232.go
index 0d25e1863d..f4728f6e7c 100644
--- a/test/typeparam/issue51232.go
+++ b/test/typeparam/issue51232.go
@@ -13,19 +13,19 @@ type RC[RG any] interface {
type Fn[RCT RC[RG], RG any] func(RCT)
type F[RCT RC[RG], RG any] interface {
- Fn() Fn[RCT] // ERROR "got 1 arguments"
+ Fn() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
}
type concreteF[RCT RC[RG], RG any] struct {
- makeFn func() Fn[RCT] // ERROR "got 1 arguments"
+ makeFn func() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
}
-func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "got 1 arguments"
+func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "not enough type arguments for type Fn: have 1, want 2"
return c.makeFn()
}
-func NewConcrete[RCT RC[RG], RG any](Rc RCT) F[RCT] { // ERROR "got 1 arguments"
- return &concreteF[RCT]{ // ERROR "cannot use" "got 1 arguments"
+func NewConcrete[RCT RC[RG], RG any](Rc RCT) F[RCT] { // ERROR "not enough type arguments for type F: have 1, want 2"
+ return &concreteF[RCT]{ // ERROR "cannot use" "not enough type arguments for type concreteF: have 1, want 2"
makeFn: nil,
}
}
diff --git a/test/typeparam/issue51233.go b/test/typeparam/issue51233.go
index 96a25ddb9c..5f2a045d84 100644
--- a/test/typeparam/issue51233.go
+++ b/test/typeparam/issue51233.go
@@ -13,16 +13,16 @@ type RC[RG any] interface {
type Fn[RCT RC[RG], RG any] func(RCT)
-type FFn[RCT RC[RG], RG any] func() Fn[RCT] // ERROR "got 1 arguments"
+type FFn[RCT RC[RG], RG any] func() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
type F[RCT RC[RG], RG any] interface {
- Fn() Fn[RCT] // ERROR "got 1 arguments"
+ Fn() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
}
type concreteF[RCT RC[RG], RG any] struct {
- makeFn FFn[RCT] // ERROR "got 1 arguments"
+ makeFn FFn[RCT] // ERROR "not enough type arguments for type FFn: have 1, want 2"
}
-func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "got 1 arguments"
+func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "not enough type arguments for type Fn: have 1, want 2"
return c.makeFn()
}