-
Notifications
You must be signed in to change notification settings - Fork 15
Implicit source position erasing #63
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
Conversation
e908595 to
026b5d6
Compare
2fb9869 to
61281f0
Compare
|
I've reviewed the latest commit on "Fully qualified Lexing.position and Lexing.dummy_pos" |
|
Chatted with @alanechang briefly about this today in our 1:1. He pointed out that there is a ppx somewhere to delete probes when compiled upstream. This works well for probes, as they're encoded as extensions, with the |
|
@goldfirere Oh that approach sounds interesting. I've added a comment summarizing my understanding of that approach. Please let me know if the comment is reasonable/if I should edit it. Thanks! |
|
This looks all ready for merging. So sorry about the delay here! |
source position erasing Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
The bug was that (in the context of a type): ```ocaml src_pos:[%src_pos] -> CORE_TYPE ``` was erased to: ```ocaml src_pos:Lexing.position -> CORE_TYPE ``` where it should instead have translated to (an optional parameter): ```ocaml ?src_pos:Lexing.position -> CORE_TYPE ``` Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
…ng suffix to use kebab case. Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
Signed-off-by: enoumy <enoumy@gmail.com>
…ching deeply on the syntax. Signed-off-by: enoumy <enoumy@gmail.com>
5af408b to
bee3cd8
Compare
This feature updated ocamlformat to adds erasing support for implicit source code positions!
It performs the following erasures:
and
The approach taken in this feature is to always expands
[%src_pos]to Location.dummy_pos and not - say generate the record for the source of the actual location. Other possible approaches/solutions include that might be possible to switch this to are:[%here](assuming that ppx_here will be accessible in the code that gets erased)lexing_positionrecord in-place. (I chose not to do this in the initial version due to the "equality" sanity check potentially being harder to implement as two equal "normalized" AST's could have different AST outputs if their parse locations are slightly different.)Testing
I added tests for this in
test/passing/tests/implicit_source_position_erased.mlfollowing the pattern oflocal_erased.mltests. Please let me know if there are any other tests I should create. Thanks!