Open epatrizio opened 1 year ago
Acknowledged! Thanks for the report and the small repro :+1:
Sorry, the details of ppxlib
are a bit hazy ATM... :sweat_smile:
I suspect this is due to
https://github.com/jmid/mutaml/blob/4a3e83feff4e3f7c2e0d9c7fa3caacc4b7c2dcaa/src/ppx/entry.ml#L64
As an experiment could you try changing it to After
instead?
I don't know if it's possible to tell dune to instrument the code only after preprocessing ? Otherwise, should the instrumentation tool (mutaml) be careful and not modify code that contains preprocessing annotations ?
Yep, I suspect something like that would be preferable.
In the present case we don't want Before
- but I don't think we want After
either, as that would enable mutations of preprocessor-generated code that a developer is not writing themself... :thinking:
It seems to work with After
, thanks !
Indeed, I'm not sure we want to instrument code that has been generated by a preprocessor. Maybe we could just keep Before
and ignore code that is annotated ?
Same on my small example, it works with After
, thanks!
Hello, It seems that the instrumentation is launched before the preprocessor, generating errors in some cases. Here is a minimalistic example with sedlex preprocessing :
What happens is that
mutaml
inserts somewhen
guards on a branch from amatch%sedlex
construct. Sedlex then complains because it can not handle such guards. I don't know if it's possible to tell dune to instrument the code only after preprocessing ? Otherwise, should the instrumentation tool (mutaml
) be careful and not modify code that contains preprocessing annotations ? Thanks a lot!