Skip to content

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

@maroneze

Description

@maroneze

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions