landmarks icon indicating copy to clipboard operation
landmarks copied to clipboard

Automatic instrumentation via landmarks-ppx and inherited constructors without module name

Open maroneze opened this issue 3 years ago • 0 comments

This is a simplified example of an issue that happened with Frama-C's visitors:

(* a.ml *)
type visitAction = Go | Skip
class visitor = object
  method visit () = Go
end
(* b.ml *)
class skip_visitor = object
  inherit A.visitor
  method! visit () = Skip (* Could be A.Skip, but due to inheritance, the module name is unnecessary *)
end
OCAML_LANDMARKS=auto ocamlfind ocamlopt -package landmarks -package landmarks-ppx a.ml b.ml

This fails with:

File "b.ml", line 4, characters 21-25:
4 |   method! visit () = Skip
                         ^^^^
Error: Unbound constructor Skip

Without Landmarks instrumentation, the above compiles, since the Skip constructor is found in module A.

If I explicitly write A.Skip in b.ml, it works fine.

If this is hard to fix, I believe a small addition to the Known issues section with the workaround should suffice to help people find it. Classes and inheritance are rarely used anyway in OCaml.

maroneze avatar Mar 10 '22 08:03 maroneze