Debian Codegraph @

src/internal/types/testdata/fixedbugs/issue68162.go

raw
1 // Copyright 2024 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 main
6
7 type N[B N[B]] interface {
8 Add(B) B
9 }
10
11 func Add[P N[P]](x, y P) P {
12 return x.Add(y)
13 }
14
15 type MyInt int
16
17 func (x MyInt) Add(y MyInt) MyInt {
18 return x + y
19 }
20
21 func main() {
22 var x, y MyInt = 2, 3
23 println(Add(x, y))
24 }