diff --git a/internal/astnav/tokens.go b/internal/astnav/tokens.go index feac94654d..0c09257277 100644 --- a/internal/astnav/tokens.go +++ b/internal/astnav/tokens.go @@ -82,7 +82,7 @@ func getTokenAtPosition( } visitNodes := func(nodes []*ast.Node) { - index, match := core.BinarySearchUniqueFunc(nodes, position, func(middle int, node *ast.Node) int { + index, match := core.BinarySearchUniqueFunc(nodes, func(middle int, node *ast.Node) int { cmp := testNode(node) if cmp < 0 { left = node.End() diff --git a/internal/core/binarysearch.go b/internal/core/binarysearch.go index 15871dcc47..43605d228e 100644 --- a/internal/core/binarysearch.go +++ b/internal/core/binarysearch.go @@ -5,7 +5,7 @@ package core // in the slice could match the target. Also, unlike [slices.BinarySearchFunc], // the comparison function is passed the current index of the element being // compared, instead of the target element. -func BinarySearchUniqueFunc[S ~[]E, E, T any](x S, target T, cmp func(int, E) int) (int, bool) { +func BinarySearchUniqueFunc[S ~[]E, E any](x S, cmp func(int, E) int) (int, bool) { n := len(x) low, high := 0, n-1 for low <= high {