Support scannable axes#2794
Closed
julesjacobs wants to merge 85 commits into
Closed
Conversation
The jane branch was previously about 7 months behind upstream, so this rebase catches us up. Rebases were getting unwieldy due to the divergence of upstream and poor commit history of jane, so squashing these commits into one made it easier to resolve conflicts, especially in places where fixes to earlier merge conflicts depended on changes introduced in later commits. Notable changes in this commit: - Initial patches to parser for janestreet specific extensions (local_, global_) - Support for `include functor` - Support for polymorphic function parameters - Support for comprehensions - Support for immutable arrays - Support for layout annotations - Support for `exclave_` syntax - Support for unboxed float literals and `float#` - Support for explicit strengthening - Mode for rewriting local-mode attributes into their keyword form Changes authored by: - antalsz - ccasin - cwong-ocaml - goldfirere - Julow - riaqn - rleshchinskiy - stedolan - tdelvecchio-jsc Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
* remove rewrite flag Signed-off-by: alanechang <alanechang@janestreet.com> * track local rewrites and fix ast equality check Signed-off-by: alanechang <alanechang@janestreet.com> * rename option Signed-off-by: alanechang <alanechang@janestreet.com> * convert old syntax to new in standard ast Signed-off-by: alanechang <alanechang@janestreet.com> * remove local_rewrite_occurred Signed-off-by: alanechang <alanechang@janestreet.com> * add comment Signed-off-by: alanechang <alanechang@janestreet.com> * remove the unused config param Signed-off-by: alanechang <alanechang@janestreet.com> * remove the ability to erase legacy local annots Signed-off-by: alanechang <alanechang@janestreet.com> * fix an issue around location ghost Signed-off-by: alanechang <alanechang@janestreet.com> * add comment Signed-off-by: alanechang <alanechang@janestreet.com> * add additional test Signed-off-by: alanechang <alanechang@janestreet.com> * update man page Signed-off-by: alanechang <alanechang@janestreet.com> * fix ast normalize for pattern Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
* parser diff Signed-off-by: alanechang <alanechang@janestreet.com> other diffs Signed-off-by: alanechang <alanechang@janestreet.com> jane syntax diff Signed-off-by: alanechang <alanechang@janestreet.com> ast helper diff Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> copy paste Signed-off-by: alanechang <alanechang@janestreet.com> add match_jane_syntax_piece Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> parser standard updated Signed-off-by: alanechang <alanechang@janestreet.com> fix parser Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> wip Signed-off-by: alanechang <alanechang@janestreet.com> building now Signed-off-by: alanechang <alanechang@janestreet.com> fix format Signed-off-by: alanechang <alanechang@janestreet.com> fix format Signed-off-by: alanechang <alanechang@janestreet.com> fix up paren Signed-off-by: alanechang <alanechang@janestreet.com> new layout annot for type decl Signed-off-by: alanechang <alanechang@janestreet.com> add new test Signed-off-by: alanechang <alanechang@janestreet.com> new layout annot on type decl Signed-off-by: alanechang <alanechang@janestreet.com> fix paren Signed-off-by: alanechang <alanechang@janestreet.com> remove extra paren Signed-off-by: alanechang <alanechang@janestreet.com> test changes Signed-off-by: alanechang <alanechang@janestreet.com> handle layout annot and attr differently Signed-off-by: alanechang <alanechang@janestreet.com> test changes Signed-off-by: alanechang <alanechang@janestreet.com> diff changes Signed-off-by: alanechang <alanechang@janestreet.com> parenize in more ctx Signed-off-by: alanechang <alanechang@janestreet.com> remove cr Signed-off-by: alanechang <alanechang@janestreet.com> clean up newtype Signed-off-by: alanechang <alanechang@janestreet.com> test and diff Signed-off-by: alanechang <alanechang@janestreet.com> fix comment bug Signed-off-by: alanechang <alanechang@janestreet.com> add missing map Signed-off-by: alanechang <alanechang@janestreet.com> refactor Signed-off-by: alanechang <alanechang@janestreet.com> more clean up Signed-off-by: alanechang <alanechang@janestreet.com> test change Signed-off-by: alanechang <alanechang@janestreet.com> reduce diff Signed-off-by: alanechang <alanechang@janestreet.com> less diff Signed-off-by: alanechang <alanechang@janestreet.com> new patch Signed-off-by: alanechang <alanechang@janestreet.com> add new line Signed-off-by: alanechang <alanechang@janestreet.com> patch diff Signed-off-by: alanechang <alanechang@janestreet.com> more tests Signed-off-by: alanechang <alanechang@janestreet.com> * tests for multiple newtypes Signed-off-by: alanechang <alanechang@janestreet.com> * tyvar name string to string option Signed-off-by: alanechang <alanechang@janestreet.com> * remove support for legacy layout attr Signed-off-by: alanechang <alanechang@janestreet.com> * reduce diff Signed-off-by: alanechang <alanechang@janestreet.com> * refactor fmt_type_var Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
* fix local syntax normalization Signed-off-by: alanechang <alanechang@janestreet.com> * fix comment Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
* exclave and global should not drop comments Signed-off-by: alanechang <alanechang@janestreet.com> * keep attrs during local rewrite Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
* Doc improvements * Tweak dune exec invocation
* Fix parenthesization of labeled tuple patterns * Ppat_open tests
* Fix bug where `42, ~x:(fun x -> x)` would be misformatted (The parens would be dropped) * Fix parens for local_ labeled tuple returns
Signed-off-by: alanechang <alanechang@janestreet.com>
* add failing test Signed-off-by: alanechang <alanechang@janestreet.com> * add fix Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
* erase layout Signed-off-by: alanechang <alanechang@janestreet.com> * type name change Signed-off-by: alanechang <alanechang@janestreet.com> * mark type decl layout annot erasable Signed-off-by: alanechang <alanechang@janestreet.com> * add tests Signed-off-by: alanechang <alanechang@janestreet.com> * rewrite new layout annotation of immediate into legacy attr Signed-off-by: alanechang <alanechang@janestreet.com> * rewrite immediacy attributes to layout annotations Signed-off-by: alanechang <alanechang@janestreet.com> * normalize "ocaml.immediate" into "immediate" Signed-off-by: alanechang <alanechang@janestreet.com> * don't do the rewrite if that drops payloads Signed-off-by: alanechang <alanechang@janestreet.com> * move comments before the type decl Signed-off-by: alanechang <alanechang@janestreet.com> * add comment about similar functions Signed-off-by: alanechang <alanechang@janestreet.com> --------- Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: Jose Rodriguez <enoumy@gmail.com>
* Sanity ocamlformat transformation and also added tests for implicit source position erasing Signed-off-by: enoumy <enoumy@gmail.com> * Erased implicit source position arguments via [Lexing.dummy_pos] Signed-off-by: enoumy <enoumy@gmail.com> * Found and fixed a bug during self review. 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> * Renamed src_pos -> call_pos argument Signed-off-by: enoumy <enoumy@gmail.com> * Removed unnecessary change found during self review Signed-off-by: enoumy <enoumy@gmail.com> * Updated out-of-place comment during self-review Signed-off-by: enoumy <enoumy@gmail.com> * Removed lingering test cases Signed-off-by: enoumy <enoumy@gmail.com> * Added test that does not pass erased flag. Signed-off-by: enoumy <enoumy@gmail.com> * De-duplicated duplicated `implicit_source_position.ml` file by changing suffix to use kebab case. Signed-off-by: enoumy <enoumy@gmail.com> * Fully qualified Lexing.position and Lexing.dummy_pos Signed-off-by: enoumy <enoumy@gmail.com> * Refactored erasing approach with at-parse-time [mly] approach. Signed-off-by: enoumy <enoumy@gmail.com> * Removed unintended whitespace change Signed-off-by: enoumy <enoumy@gmail.com> * Added note with alternate approach. Signed-off-by: enoumy <enoumy@gmail.com> * Added test with locals Signed-off-by: enoumy <enoumy@gmail.com> * Changed extended parser.mly to perform erase check before pattern matching deeply on the syntax. Signed-off-by: enoumy <enoumy@gmail.com> --------- Signed-off-by: enoumy <enoumy@gmail.com>
* passes tests Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * changed name of the type back to [const_layout] Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * added some tests Signed-off-by: Charlie Gunn <cgunn@janestreet.com> --------- Signed-off-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Charlie Gunn <cgunn@janestreet.com>
* Fixed bug, changed a test to test it, re-enabled windows build Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * Simplify match statement Co-authored-by: Richard Eisenberg <rae@richarde.dev> Signed-off-by: Charlie Gunn <cgunn@janestreet.com> --------- Signed-off-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Richard Eisenberg <rae@richarde.dev>
* extensions.ml removed, tests passing Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * responding to review Signed-off-by: Charlie Gunn <cgunn@janestreet.com> --------- Signed-off-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Charlie Gunn <cgunn@janestreet.com>
* Rename `layout` to `jkind` in most places Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * formatting Signed-off-by: Charlie Gunn <cgunn@janestreet.com> * It's still CR layouts; that's the thing we search for --------- Signed-off-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Charlie Gunn <cgunn@janestreet.com> Co-authored-by: Richard Eisenberg <reisenberg@janestreet.com>
* add [*.js-ref] support to testing script Signed-off-by: David Vulakh <dvulakh@janestreet.com> * add [*.js-ref] tests throughout the test suite Signed-off-by: David Vulakh <dvulakh@janestreet.com> * delete empty [*.js-err]s Signed-off-by: David Vulakh <dvulakh@janestreet.com> * turn off local configs when running [*.js-ref] Signed-off-by: David Vulakh <dvulakh@janestreet.com> * ignore [*.opts] when testing [*.js-ref] we don't internally permit command-line configuration, so we're mostly interested in the default behavior of the janestreet profile Signed-off-by: David Vulakh <dvulakh@janestreet.com> * revert unneeded changes to [*.opts] when the [*.js-ref] tests obeyed [.ocamlformat] and [*.opts], we used [*.opts] to increase the default low [--max-iters] now that we ignore [.ocamlformat] from [*.js-ref] tests, we don't need to change [*.opts] Signed-off-by: David Vulakh <dvulakh@janestreet.com> * enforce comprehensive [*.js-ref] testing we check that every non-js test either has a corresponding js test, or an explanation of why it shouldn't be stressed under the janestreet profile Signed-off-by: David Vulakh <dvulakh@janestreet.com> * remove most [--profile=janestreet] in [*.opts] also merge [source.ml] and [js_source.ml] one [*.opts] with [--profile=janestreet] remains because it is for a file that is currently broken in the ocamlformat profile Signed-off-by: David Vulakh <dvulakh@janestreet.com> * run dune fmt Signed-off-by: David Vulakh <dvulakh@janestreet.com> * disable comprehensiveness tests on win it suffices for these tests to run during local development on linux and as part of the github ci Signed-off-by: David Vulakh <dvulakh@janestreet.com> * only generate js-coverage rules that will fail Signed-off-by: David Vulakh <dvulakh@janestreet.com> --------- Signed-off-by: David Vulakh <dvulakh@janestreet.com>
…inline records (#75)
Signed-off-by: Thomas Del Vecchio <tdelvecchio@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
* Erase unboxed tuples * erase unboxed records * Remove erasure js-ref files * Normalization logic for standard parser
Signed-off-by: Zesen Qian <github@riaqn.org>
* change workflow to ubuntu-latest Signed-off-by: David Vulakh <dvulakh@janestreet.com> * delete actions we don't use namely, changelog and pr-number actions, which look like holdovers from an old tarides version of the repo and are broken now that the underlying runners have been deprecated Signed-off-by: David Vulakh <dvulakh@janestreet.com> --------- Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: Megan Del Vecchio <mdelvecchio@janestreet.com>
* Remove redundant erased test under js profile. Signed-off-by: Megan Del Vecchio <mdelvecchio@janestreet.com> * Fix dune file. Signed-off-by: Megan Del Vecchio <mdelvecchio@janestreet.com> * use consistent [why-no-js] for erased Signed-off-by: David Vulakh <dvulakh@janestreet.com> --------- Signed-off-by: Megan Del Vecchio <mdelvecchio@janestreet.com> Signed-off-by: David Vulakh <dvulakh@janestreet.com> Co-authored-by: David Vulakh <dvulakh@janestreet.com>
* Add support for Tof_kind This is a new core_type_desc, used for referring to the kinds of existential types in with-bounds for GADTs. Signed-off-by: Aspen Smith <aspsmith@janestreet.com> * Don't erase in parser * Self-format * More attributes * More types --------- Signed-off-by: Aspen Smith <aspsmith@janestreet.com>
…ides in method definitions (#114) * Add special formatting rules to avoid generating ]>. Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com> * Add tests for avoiding ]>. Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com> * Rename test (object3 -> override2). Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com> * Fix empty list issue. Simplify space logic. Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com> * Address comments. Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com> --------- Signed-off-by: Andrej Ivaskovic <aivaskovic@janestreet.com>
* fix modes on modules in expressions & structures Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix edit artifact Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix modalities to use less quiet syntax Signed-off-by: David Vulakh <dvulakh@janestreet.com> * pr feedback Signed-off-by: David Vulakh <dvulakh@janestreet.com> --------- Signed-off-by: David Vulakh <dvulakh@janestreet.com>
--------- Co-authored-by: James Rayman <james@jamesrayman.com>
* Bin_conf: don't pass info to update_using_cmdline There is only a single instance anyway. * Bin_conf: parse cmdline only once and cache result Otherwise the config parser would run for every argument, resulting in quadratic parsing. * Format Bin_conf * Update CHANGES.md
…#119) Signed-off-by: David Vulakh <dvulakh@janestreet.com> Co-authored-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
* format comments Signed-off-by: David Vulakh <dvulakh@janestreet.com> * dune build @gen_manpage Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix doc comment toggling Signed-off-by: David Vulakh <dvulakh@janestreet.com> * add more tests of code-like constructs Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix code-like constructs Signed-off-by: David Vulakh <dvulakh@janestreet.com> * add footnote-style lists added lists for numbers only; letters are likely to be code, I think Signed-off-by: David Vulakh <dvulakh@janestreet.com> * delete editing artifact Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix \[0\] regression Signed-off-by: David Vulakh <dvulakh@janestreet.com> * fix another footnote-related bug [1] at start of line specifically Signed-off-by: David Vulakh <dvulakh@janestreet.com> * recognize flower comments more generously Signed-off-by: David Vulakh <dvulakh@janestreet.com> --------- Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Co-authored-by: Nailen Matschke <nmatschke@janestreet.com>
* Add regression test * Fix and promote * Add multi-param wildcard jkind test case Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These now parse and format correctly:
Qualified abbreviations are supported too:
And scannable modifiers compose correctly with existing kind syntax:
These are preserved rather than rewritten: