Skip to content

Conversation

vouillon
Copy link
Member

Since we only keep the first 36 bits of the string, we get collisions pretty easily if we use the filename directly.

Since we only keep the first 36 bits of the string, we get collisions
pretty easily if we use the filename directly.
@vouillon vouillon requested a review from Julow April 22, 2025 15:27
@@ -283,7 +283,7 @@ module Cmo = struct
; ev_kind = Event_after ty
; _ } ->
if pos_cnum' = pos_cnum + 1
then Hashtbl.add events (Filename.basename pos_fname, pos_cnum) ty
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used internally, so we can keep the full path here.

Copy link
Contributor

@Julow Julow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! It would be nice to have a testsuite for the ppx to avoid these in the future. I tested #810 in an ocsigen application that was too small to encounter a collision.

@vouillon vouillon merged commit 61ed373 into master Apr 23, 2025
5 checks passed
@vouillon vouillon deleted the ppx-fix branch April 23, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants