2022-02-24 12:18:24 -07:00
|
|
|
// errorcheck
|
2022-02-24 14:35:16 -07:00
|
|
|
|
|
|
|
// 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 {
|
2023-11-20 18:43:13 -07:00
|
|
|
Fn() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
|
2022-02-24 14:35:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type concreteF[RCT RC[RG], RG any] struct {
|
2023-11-20 18:43:13 -07:00
|
|
|
makeFn func() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
|
2022-02-24 14:35:16 -07:00
|
|
|
}
|
|
|
|
|
2023-11-20 18:43:13 -07:00
|
|
|
func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "not enough type arguments for type Fn: have 1, want 2"
|
2022-02-24 14:35:16 -07:00
|
|
|
return c.makeFn()
|
|
|
|
}
|
|
|
|
|
2023-11-20 18:43:13 -07:00
|
|
|
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"
|
2022-02-24 14:35:16 -07:00
|
|
|
makeFn: nil,
|
|
|
|
}
|
|
|
|
}
|