Source file
test/typeparam/issue58513.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14 package main
15
16 import "runtime"
17
18 func assert[_ any]() {
19 panic(0)
20 }
21
22 func Assert[To any]() func() {
23 return assert[To]
24 }
25
26 type asserter[_ any] struct{}
27
28 func (asserter[_]) assert() {
29 panic(0)
30 }
31
32 func AssertMV[To any]() func() {
33 return asserter[To]{}.assert
34 }
35
36 func AssertME[To any]() func(asserter[To]) {
37 return asserter[To].assert
38 }
39
40 var me = AssertME[string]()
41
42 var tests = []func(){
43 Assert[int](),
44 AssertMV[int](),
45 func() { me(asserter[string]{}) },
46 }
47
48 func main() {
49 for _, test := range tests {
50 func() {
51 defer func() {
52 recover()
53
54
55 runtime.Caller(1000)
56 }()
57 test()
58 }()
59 }
60 }
61
View as plain text