Debian Codegraph @

test/typeparam/issue51232.go

raw
1 // errorcheck
2
3 // Copyright 2022 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 package p
8
9 type RC[RG any] interface {
10 ~[]RG
11 }
12
13 type Fn[RCT RC[RG], RG any] func(RCT)
14
15 type F[RCT RC[RG], RG any] interface {
16 Fn() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
17 }
18
19 type concreteF[RCT RC[RG], RG any] struct {
20 makeFn func() Fn[RCT] // ERROR "not enough type arguments for type Fn: have 1, want 2"
21 }
22
23 func (c *concreteF[RCT, RG]) Fn() Fn[RCT] { // ERROR "not enough type arguments for type Fn: have 1, want 2"
24 return c.makeFn()
25 }
26
27 func NewConcrete[RCT RC[RG], RG any](Rc RCT) F[RCT] { // ERROR "not enough type arguments for type F: have 1, want 2"
28 return &concreteF[RCT]{ // ERROR "cannot use" "not enough type arguments for type concreteF: have 1, want 2"
29 makeFn: nil,
30 }
31 }