Debian Codegraph @

debian/patches/0001-update-generic-types.patch

raw symbols SCIP
1 From: Maytham Alsudany <[email protected]>
2 Forwarded: no
3 Description: Update generic types to match Go 1.24
4
5 --- a/slices/delegated_sort.go
6 +++ b/slices/delegated_sort.go
7 @@ -14,13 +14,13 @@
8
9 // Sort sorts the slice x in ascending order as determined by the less function.
10 // This sort is not guaranteed to be stable.
11 -func SortFunc[E any](x []E, less func(a, b E) bool) {
12 +func SortFunc[E any](x []E, less func(a, b E) int) {
13 slices.SortFunc(x, less)
14 }
15
16 // SortStable sorts the slice x while keeping the original order of equal
17 // elements, using less to compare elements.
18 -func SortStableFunc[E any](x []E, less func(a, b E) bool) {
19 +func SortStableFunc[E any](x []E, less func(a, b E) int) {
20 slices.SortStableFunc(x, less)
21 }
22
23 @@ -31,7 +31,7 @@
24
25 // IsSortedFunc reports whether x is sorted in ascending order, with less as the
26 // comparison function.
27 -func IsSortedFunc[E any](x []E, less func(a, b E) bool) bool {
28 +func IsSortedFunc[E any](x []E, less func(a, b E) int) bool {
29 return slices.IsSortedFunc(x, less)
30 }
31
32 @@ -40,7 +40,7 @@
33 // which it could be inserted into the slice is returned; therefore, if the
34 // intention is to find target itself a separate check for equality with the
35 // element at the returned index is required.
36 -func BinarySearch[E constraints.Ordered](x []E, target E) int {
37 +func BinarySearch[E constraints.Ordered](x []E, target E) (int, bool) {
38 return slices.BinarySearch(x, target)
39 }
40
41 @@ -52,6 +52,6 @@
42 // the first true index. If there is no such index, BinarySearchFunc returns n.
43 // (Note that the "not found" return value is not -1 as in, for instance,
44 // strings.Index.) Search calls ok(i) only for i in the range [0, n).
45 -func BinarySearchFunc[E any](x []E, ok func(E) bool) int {
46 - return slices.BinarySearchFunc(x, ok)
47 +func BinarySearchFunc[E, T any](x []E, target T, cmp func(E, T) int) (int, bool) {
48 + return slices.BinarySearchFunc(x, target, cmp)
49 }
50 --- a/list/comparable_list.go
51 +++ b/list/comparable_list.go
52 @@ -37,6 +37,6 @@
53 }
54
55 // Sorts in-place
56 -func (l *ComparableList[T]) SortFunc(test func(a T, b T) bool) {
57 +func (l *ComparableList[T]) SortFunc(test func(a T, b T) int) {
58 slices.SortFunc(l.slice, test)
59 }