-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Good Practices... (locations check related issues) #515
Comments
Thanks for taking interest in I'm not quite sure I understand the problem you ran into. Is it that you're trying to write a ppx and it seems to break the location invariant? Could you provide the steps to reproduce this with a minimal example? Some elements to help you here, in case I understood correctly:
|
I've taken a look at your repo. The failure with If you set the location of the generated node to ghost, the error goes away. I'm a bit more puzzled by the
|
@NathanReb I looked again, and I seems to understand better what happening. I agree that pps_repr was bad, not it doesn't complain. It reports compilation error in generated code in decent locations, as I desired. (I was reading manual not carefully enough, my bad.) About ppx_fresh I'm puzzled too. Which expert should we @ mention in this conversation? |
I just started working on a better AST pretty-printing utility for ppxlib here: #517. I'll try to use it to debug what's going on with ppx_fresh and get back to you! |
I just fixed it here: Kakadu/ppxlib_check_demo#1 It was a simple bug and indeed the locations were off! |
If you don't have any further questions, I think we can close this issue! |
Hey, @NathanReb I have a small trouble with rewriters that use open Ppxlib
let mapper =
object (_self)
inherit Ast_traverse.map as super
end
let () = Ppxlib.Driver.register_transformation ~impl:mapper#structure "asdfasdf" but for the following code let () =
let ( let* ) x f = f x in
let* x = "asdf" in
print_string x I still get and error message about locations.
It looks like it only happen for AST nodes |
I read a manual recently, and I created some questions.
The second point sounds reasonable but over restrictive. I'm worried that ghost locations may damage error reporting in the generated code. Maybe banning overlap modulo being the same location will not damage merlin?
Also, I'm confused about how to debug issues when they come. Previously, I passed -dparsetree to compiler flags to see parsetree but now ppxlib fails earlier, and I don't know what to do. (Removing rewriter switches -check and -locations-check helps, is there a better solution?) I thought about copypasting the command with rewriter, but it looks like directories
_build/.sandbox/40b4a257626a7d996349a54dd4dcc8b9
are silently deleted. (Don't remember they have been deleted before, but maybe it is gallucination)This is the repo with my attempts, if anybody interested. https://github.com/Kakadu/ppxlib_check_demo There are two rewriters there.
ppx_repr
fails because equality of siblings' locations is forbidden. Why the demo about ppx_fresh fails? (I have no idea)Minor stuff
The text was updated successfully, but these errors were encountered: