blob: 1b406593f888a47fc8eb7682c142c9725402a9bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright 2020 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.
// If types2.Config.AcceptMethodTypeParams is set,
// the type checker accepts methods that have their
// own type parameter list.
package p
type S struct{}
func (S) m[T any](v T) {}
// TODO(gri) Once we collect interface method type parameters
// in the parser, we can enable these tests again.
/*
type I interface {
m[T any](v T)
}
type J interface {
m[T any](v T)
}
var _ I = S{}
var _ I = J(nil)
type C interface{ n() }
type Sc struct{}
func (Sc) m[T C](v T)
type Ic interface {
m[T C](v T)
}
type Jc interface {
m[T C](v T)
}
var _ Ic = Sc{}
var _ Ic = Jc(nil)
// TODO(gri) These should fail because the constraints don't match.
var _ I = Sc{}
var _ I = Jc(nil)
var _ Ic = S{}
var _ Ic = J(nil)
*/
|