-
Notifications
You must be signed in to change notification settings - Fork 350
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
Add locations-check test #844
Conversation
File "input.ml", line 1, characters 33-36: | ||
1 | let[@react.component] make ~foo ~bar = | ||
^^^ | ||
Error: invalid output from ppx, core type overlaps with core type at location: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty nice.
I wonder if the failing tests will now pass after the ppxlib 0.33 release
They do. I just had to modify one location in the ppx tests (seems not harmful). |
Hm just realized this change was already in #850. I forgot to merge |
|
||
$ reason-react-ppx -check -locations-check input.ml | ||
File "input.ml", line 2, characters 3-6: | ||
2 | (div |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this expected? What exactly is this test testing if these are errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or are these things we should put on our TODO list to fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this should go in a TODO list to fix. The idea behind it is that if the ppx creates the AST in a way that this tests pass, we should never have any more problems with editor not finding locations, getting confused about types on hover, etc, as the tree would be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than having to write "manual" tests in a per-case basis like in #842.
* 'main' of github.com:/reasonml/reason-react: fix: type of pipeable stream to allow objects with keys (#854) reason-react-ppx: + lower bound in ocaml add missing entries to changelog Fix multi-child fragment (#852) update compiler version in makefile cmd (#851) Add locations-check test (#844) fix: re-enable failing tests + fix location tests (#850) test: repro #840 (#842) Add CSS Box Alignment Module Level 3 (#847)
I found out today that ppxlib has some
-check -locations-check
flag that one can use to make sure a ppx generates an AST with valid locations ("valid" in the sense of following the Merlin rules).I thought this could serve as an alternative to tests like the one @anmonteiro adds in #842 and the many other merlin-based tests that we have.
Rather than building the test based on what merlin returns, we can just make sure the tree is well formed. But it turns out the check doesn't successfully pass (even in 5.1), because there are too many overlaps.
Maybe we can keep the test as is for now and over time solve all issues until we make sure it passed this check. @davesnx @anmonteiro wdyt?