Hide warnings in typed PPX

Hello, sorry for my bad English.

Can I hide the warning 20 when type checking with Typemod.copy_structure in PPX?

I am creating a PPX rewriter that adds Obj.magic(), type checks by Typemod.copy_structure and processes, and finally removes Obj.magic() and outputs. I understand the usefulness of warning 20, but find the intermediate file warnings annoying.

If you are typechecking generated code, you could also emit

[@@@warning "-20"]

at the top of your generated code. Alternatively, you could use Warnings.without_warning (this disables all warning), or Warnings.parse_options false "-20" to disable just that options. (The module Warnings is part of compiler-libs.)

Cheers,
Nicolas

1 Like