codex-semantics-library / patricia-tree

Patricia Tree data structure in OCaml for maps and sets, supports generic (GADT) keys
https://codex.top/api/patricia-tree/
GNU Lesser General Public License v2.1
12 stars 0 forks source link

Warning 53 (misplaced-attribute) on OCaml 5.2 #7

Closed mlemerre closed 4 months ago

mlemerre commented 4 months ago

I have the following error

145 | val highest_bit : int -> (int [@untagged]);;
                                      ^^^^^^^^
Error (warning 53 [misplaced-attribute]): the "untagged" attribute cannot appear in this context

I fixed those concerning the specialise tag (check that it is OK) but I am not sure how to fix those as they seem OK to me... I'm open for ideas!

mlemerre commented 4 months ago

This does not seem correct. The returned integer is not an OCaml integer, so I doubt that we can just drop the attribute.

dlesbre commented 4 months ago

OCaml wraps the function in that case, otherwise there would be a bug in the ocaml compiler.

See the compiler explorer for differences between compiling with/without a constrained signature.

Another possible fix is to expose the external in the mli directly. I'd rather hide the implementation though.

mlemerre commented 4 months ago

Actually, the function is used only for testing; moreover, changing the implementation would retain source-level compatibility. I think exposing the external would be safe.

dlesbre commented 4 months ago

Done.