-
Notifications
You must be signed in to change notification settings - Fork 430
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
Fix top level extensions #2693
Fix top level extensions #2693
Conversation
…el-extensions * 'master' of github.com:/reasonml/reason: chore: update nix flake (reasonml#2692) chore(readme): clarify 3.9 is unreleased Fix ppat_constraint case (reasonml#2690)
let last = match (List.rev structureItems) with | last::_ -> last | [] -> assert false in | ||
let loc_start = first.pstr_loc.loc_start in | ||
let loc_end = last.pstr_loc.loc_end in | ||
let items = | ||
groupAndPrint | ||
~xf:self#structure_item | ||
~xf:self#top_level_structure_item |
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.
This looks fishy.
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.
Probably a bad name, but the logic is to check for a specific combination of AST such as: structure -> structure_item -> Pexp_extension
e9cbe7b
to
48e5ac9
Compare
@@ -348,7 +348,7 @@ let () = { | |||
something_else(); | |||
}; | |||
|
|||
[%bs.raw x => x]; |
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.
don't we also accept this form? I think it should keep being tested.
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.
Pushed back the test case, we do support them.
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.
It's still removed. did you forget to push?
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.
I added all of the cases in the cram tests. Let me add them in the formatTest
as well
method structure structureItems = | ||
(* We don't have any way to know if an extension is placed at the top level by the parsetree |
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.
I thought we supported extensions at the toplevel with %
, and that %%bs.raw
was specifically a bucklescript thing.
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.
It is a BuckleScript thing, but we support both cases. Would be a nice idea to unify all of these cases with Melange. %bs.raw
-> bs.raw_js_expr
and %%bs.raw
-> bs.raw_js
or something like this.
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.
I don't get what needs to be unified?
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.
We could avoid having %
and %%
at the same time and support only %
…el-extensions * 'master' of github.com:/reasonml/reason: Install before importing deps Update package json and install esy normally Re-arrange esy install Reduce install esy time Use master branch instead of main Ignore _export from esy Rename refmt_test to test Add esy-ci and opam-ci Remove jbuild-ignore
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.
This needs a changelog entry in HISTORY.md. Then please "squash and merge" it.
…mat-type-tests-to-cram * 'master' of github.com:/reasonml/reason: Fix top level extensions (reasonml#2693) Install before importing deps Update package json and install esy normally Re-arrange esy install Reduce install esy time Use master branch instead of main Ignore _export from esy Rename refmt_test to test Add esy-ci and opam-ci Remove jbuild-ignore
* master: (38 commits) chore: remove old BS_NO_COMPILER_PATCH flag (reasonml#2710) Improve printing of modules types with one line inside (reasonml#2709) generate opam files with dune (reasonml#2704) Fix version on refmt (reasonml#2701) Drop the result dependency (reasonml#2703) Remove old CI and test.sh (reasonml#2705) Migrate tests to cram suite (reasonml#2694) Make sure win doesnt break when importing (reasonml#2700) Fix top level extensions (reasonml#2693) Install before importing deps Update package json and install esy normally Re-arrange esy install Reduce install esy time Use master branch instead of main Ignore _export from esy Rename refmt_test to test Add esy-ci and opam-ci Remove jbuild-ignore chore: update nix flake (reasonml#2692) chore(readme): clarify 3.9 is unreleased ...
* master: (38 commits) chore: remove old BS_NO_COMPILER_PATCH flag (reasonml#2710) Improve printing of modules types with one line inside (reasonml#2709) generate opam files with dune (reasonml#2704) Fix version on refmt (reasonml#2701) Drop the result dependency (reasonml#2703) Remove old CI and test.sh (reasonml#2705) Migrate tests to cram suite (reasonml#2694) Make sure win doesnt break when importing (reasonml#2700) Fix top level extensions (reasonml#2693) Install before importing deps Update package json and install esy normally Re-arrange esy install Reduce install esy time Use master branch instead of main Ignore _export from esy Rename refmt_test to test Add esy-ci and opam-ci Remove jbuild-ignore chore: update nix flake (reasonml#2692) chore(readme): clarify 3.9 is unreleased ...
* master: fix: binary parser (reasonml#2713) Improve functor printing. (reasonml#2683) chore: remove old BS_NO_COMPILER_PATCH flag (reasonml#2710) Improve printing of modules types with one line inside (reasonml#2709) generate opam files with dune (reasonml#2704) Fix version on refmt (reasonml#2701) Drop the result dependency (reasonml#2703) Remove old CI and test.sh (reasonml#2705) Migrate tests to cram suite (reasonml#2694) Make sure win doesnt break when importing (reasonml#2700) Fix top level extensions (reasonml#2693) Install before importing deps Update package json and install esy normally Re-arrange esy install Reduce install esy time Use master branch instead of main Ignore _export from esy Rename refmt_test to test Add esy-ci and opam-ci Remove jbuild-ignore
While migrating to Reason 3.8.2 (and above) found a bug when printing extensions. It might be hidden a long time ago since most extensions aren't top-level.