Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ordering of queries by deduplicating indices. #1270

Merged
merged 1 commit into from
Nov 23, 2023
Merged

Conversation

jerhard
Copy link
Member

@jerhard jerhard commented Nov 23, 2023

Due to merging, there were some types of queries had the same integer index. This PR deduplicates the indices of these query types.

@sim642 sim642 added the bug label Nov 23, 2023
@sim642 sim642 added this to the v2.3.0 milestone Nov 23, 2023
@michael-schwarz
Copy link
Member

It seems error-prone to do this ourselves: Could we maybe have a deriver for this, similar to what enum does here: https://github.com/ocaml-ppx/ppx_deriving

@sim642
Copy link
Member

sim642 commented Nov 23, 2023

This order is the smaller of the worries there though. Duplicate indices just mean less short-circuiting in compare/equal and more collisions in hash.
The bigger problem is compare itself, where missing cases can cause real problems. The syntactic nature of PPXs means that it isn't really possible to derive compare for this type because the matching must happen on both type constructors (Any and the query) simultaneously but they're defined in different type declarations (because that's how constructors can only be defined).

@sim642 sim642 merged commit 2f5e555 into master Nov 23, 2023
16 checks passed
@sim642 sim642 deleted the query_ordering branch November 23, 2023 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants