1 // Copyright 2022 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package p
6
7 type S[A, B any] struct {
8 f int
9 }
10
11 func (S[A, B]) m() {}
12
13 // TODO(gri): with type-type inference enabled we should only report one error
14 // below. See issue #50588.
15
16 func _[A any](s S /* ERROR got 1 arguments but 2 type parameters */ [A]) {
17 // we should see no follow-on errors below
18 s.f = 1
19 s.m()
20 }
21
22 // another test case from the issue
23
24 func _() {
25 X(Interface[*F /* ERROR got 1 arguments but 2 type parameters */ [string]](Impl{}))
26 }
27
28 func X[Q Qer](fs Interface[Q]) {
29 }
30
31 type Impl struct{}
32
33 func (Impl) M() {}
34
35 type Interface[Q Qer] interface {
36 M()
37 }
38
39 type Qer interface {
40 Q()
41 }
42
43 type F[A, B any] struct{}
44
45 func (f *F[A, B]) Q() {}
46
View as plain text