Skip to content

Commit

Permalink
Make final sort determinist
Browse files Browse the repository at this point in the history
  • Loading branch information
xvw committed Sep 24, 2024
1 parent c3e9c69 commit 84c5106
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/analysis/type_search.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ let compare_result Query_protocol.{ cost = cost_a; name = a; doc = doc_a; _ }
match (c, doc_a, doc_b) with
| 0, Some _, None -> 1
| 0, None, Some _ -> -1
| 0, Some a, Some b -> Int.compare (String.length a) (String.length b)
| 0, Some doc_a, Some doc_b ->
let c = Int.compare (String.length doc_a) (String.length doc_b) in
(* Make default insertion determinist *)
if Int.equal 0 c then String.compare a b else c
| _ -> c
else c

Expand Down
8 changes: 4 additions & 4 deletions tests/test-dirs/search-by-type.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@
"doc": "Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with [0u]), in hexadecimal (if it begins with [0x] or [0X]), in octal (if it begins with [0o] or [0O]), or in binary (if it begins with [0b] or [0B]). The [0u] prefix reads the input as an unsigned integer in the range [[0, 2*max_int+1]]. If the input exceeds {!max_int} it is converted to the signed integer [min_int + input - max_int - 1]. The [_] (underscore) character can appear anywhere in the string and is ignored. Return [None] if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type [int]. @since 4.05"
}
{
"name": "Int64.of_string_opt",
"type": "string -> int64 option",
"name": "Int32.of_string_opt",
"type": "string -> int32 option",
"cost": 2,
"doc": "Same as [of_string], but return [None] instead of raising. @since 4.05"
}
{
"name": "Int32.of_string_opt",
"type": "string -> int32 option",
"name": "Int64.of_string_opt",
"type": "string -> int64 option",
"cost": 2,
"doc": "Same as [of_string], but return [None] instead of raising. @since 4.05"
}
Expand Down

0 comments on commit 84c5106

Please sign in to comment.