Skip to content

Commit f87a5d1

Browse files
committed
Add generic function to test file
1 parent a225a32 commit f87a5d1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

testdata/src/c/c.go

+12
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ func (t *Triple[K, V, T]) String() string { // want "cognitive complexity 1 of f
3434

3535
return ""
3636
} // total complexity = 1
37+
38+
type Number interface {
39+
int64 | float64
40+
}
41+
42+
func SumNumbers[K comparable, V Number](m map[K]V) V { // want "cognitive complexity 1 of func SumNumbers is high \\(> 0\\)"
43+
var s V
44+
for _, v := range m {
45+
s += v
46+
}
47+
return s
48+
} // total complexity = 1

0 commit comments

Comments
 (0)