Source file
test/typeparam/issue51909.go
1
2
3
4
5
6
7 package main
8
9 type None struct{}
10
11 type Response interface {
12 send(ctx *struct{})
13 }
14
15 type HandlerFunc[Input any] func(Input) Response
16
17 func Operation[Input any](method, path string, h HandlerFunc[Input]) {
18 var input Input
19 h(input)
20 }
21
22 func Get[Body any](path string, h HandlerFunc[struct{ Body Body }]) {
23 Operation("GET", path, h)
24 }
25
26 func main() {
27 Get("/", func(req struct{ Body None }) Response {
28 return nil
29 })
30 }
31
View as plain text