1
0
mirror of https://github.com/golang/go synced 2024-11-22 10:34:46 -07:00
go/test/typeparam/issue51232.go
Raghvender 4bf1ca4b0c 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>
2023-12-08 00:50:55 +00:00

32 lines
898 B
Go

// errorcheck
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package p
type RC[RG any] interface {
~[]RG
}
type Fn[RCT RC[RG], RG any] func(RCT)
type F[RCT RC[RG], RG any] interface {
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 "not enough type arguments for type Fn: have 1, want 2"
}
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 "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,
}
}