这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@antalsz
Copy link

@antalsz antalsz commented Jul 31, 2023

This requires matching versions of cmdliner with the CI, namely 1.2.0

stedolan and others added 30 commits March 16, 2023 21:06
(Note for future rebases: at this stage it is expected that `dune b
@test/passing/runtest` will give errors related to extra
`[@ocaml.curry]`s)
Note for future rebases: it is expected that `dune b
@test/passing/runtest` will fail at this stage, in my case with
output:

File "test/passing/dune.inc", line 3594, characters 0-205:
3594 | (rule
3595 |  (deps tests/.ocamlformat )
3596 |  (package ocamlformat)
3597 |  (action
3598 |   (with-stdout-to local.ml.stdout
3599 |    (with-stderr-to local.ml.stderr
3600 |      (run %{bin:ocamlformat} --margin-check %{dep:tests/local.ml})))))
Command exited with code 1.
For future reference during rebasing: `dune b @test/passing/runtest`
is not expected to pass on this commit.  Some uses of `local_` are
turned into `[%extension.local]`.
For reference during future rebases: `dune b @test/passing/runtest` is
expected to pass on this commit.
For future rebases: `make test` should pass at this stage.  It may be
necessary to run `dune fmt` and `make regtests-promote` (but I checked
`dune b @test/passing/runtest` succeeded first)
Autogenerated attributes are now 'extension.foo' instead of 'ocaml.foo'
Signed-off-by: Cameron Wong <cwong@janestreet.com>
* Initial support for the include_functor extension
* Add test for include functor

Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
)

A bug in the previous patch for locals causes ocamlformat to incorrectly
format local arguments which are punned with a label and have a type signature:

    fun ~(local_ x : t) -> ...

by putting an extra invalid pair of parens around (x : t). This patch removes
the parens.

Signed-off-by: Stephen Dolan <sdolan@janestreet.com>
)

Signed-off-by: Stephen Dolan <sdolan@janestreet.com>
…] (oxcaml#6)

Signed-off-by: Stephen Dolan <sdolan@janestreet.com>
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
Signed-off-by: Zesen Qian <github@riaqn.org>
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Signed-off-by: Chris Casinghino <ccasinghino@janestreet.com>
Signed-off-by: Zesen Qian <github@riaqn.org>
* remove nonlocal_

Signed-off-by: Zesen Qian <github@riaqn.org>
Signed-off-by: Zesen Qian <github@riaqn.org>
* Don't desugar `let _ = local_ x`

The desugared syntax `let local_ _ = x` is invalid.

Signed-off-by: Jules Aguillon <jules@j3s.fr>

* Restrict `let local_ ...` rewrite even more

This restricts the desugaring of `let x = local_ y` to the cases where
`x` is an identifier or an identifier with a type annotation.

Signed-off-by: Jules Aguillon <jules@j3s.fr>

* Tests: Add a .ref file for local.ml

There are syntax rewrite on locals, it's important not to change the
test input.

* Fix local_ desugaring generating invalid syntax

These two items don't have the same AST and must be recognized:

    let local_ x : string = "hi"
    let (x : string) = local_ "hi"

* Preserve `local_` position when ptyp_poly constraint

These two items don't have the same AST:

    let x : 'a . 'a -> 'a = local_ "hi"
    let local_ x : 'a. 'a -> 'a = "hi"

---------

Signed-off-by: Jules Aguillon <jules@j3s.fr>
Signed-off-by: Zesen Qian <github@riaqn.org>
* Automatic changes to patch files

This just happened when I hit `dune build`. Don't really know what's
going on.

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Updated the standard parsetree for unboxed literals

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Support unboxed literals

Testing story not complete yet; want advice.

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Make parsetree changes separated

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Checkpoint

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Still not quite working, but done for tonight

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Vendor in jane-syntax into standard

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Separate out Jane Street stuff more

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* More tests, and a bugfix

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

---------

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>
* Write instructions

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Chris's comments

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Document testing

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Typo

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Follow on from Chris's edits

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Further advice about dune errors

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Comment about `make test`

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

---------

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>
Co-authored-by: Chris Casinghino <ccasinghino@janestreet.com>
* Update parser-standard for float#

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Add support for float#

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Add tests

But this doesn't work. I'm very confused about how to test here.

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Some more type tests

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Test float#

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Forward-proof printing of float#

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Update parser-standard/language_extension

This also removes the differences between ocamlformat's
language_extension and janestreet's. Instead, we now just
call enable_maximal. Seems simpler.

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

---------

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>
* Fix formatting

This required removing some of the "Jane Street extension" markers, as
ocamlformat was moving them to unhelpful places.

Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>

* Check formatting in CI

Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>

---------

Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
* Capture a few notes from Working Conventions

Merging this will allow me to stub out the section in Working
Conventions.

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

* Chris's suggestions

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>

---------

Signed-off-by: Richard Eisenberg <reisenberg@janestreet.com>
Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
@goldfirere
Copy link

I still don't understand what this is trying to do. Is there a problem for which this is the solution? Or is this just for general hygeine? The comment says something about matching versions of cmdliner, but how does one ensure that? And what has to match what? The PR itself doesn't say anything about cmdliner or versions.

Sorry to be asking so many questions about such a small patch -- I just don't have the context I need to be able to say whether this is a good idea.

@antalsz
Copy link
Author

antalsz commented Aug 1, 2023

These are all very good questions! Let me me a bit more loquacious:

  • There are a couple of files in the repository that contain the output of the help text for ocamlformat (e.g., ocamlformat --help).
  • The CI checks that these files are consistent with the result of running the help commands.
  • The command I've added to regtests-promote promotes these help texts; it's running the appropriate dune command to regenerate them.
  • Currently, it's very easy to end up in a position where you've done all your work and then CI is unhappy because you didn't update the help texts; this change automates that.
  • The version of cmdliner used locally and remotely has to match because that affects some of the standard verbiage generated in the help text; I solved this by updating locally.

Does that help?

@goldfirere
Copy link

Yes -- thanks! Sounds very reasonable. But then maybe there should be an addition to HACKING.md that says to install cmdliner.1.2 or whatever the correct opam argument is.

Also, should I say make regtests-promote at some point? I've never done this. So if there's any change to the update instructions, please put those in the HACKING.md doc, too.

Thanks!

Signed-off-by: Antal Spector-Zabusky <antal.b.sz@gmail.com>
@antalsz antalsz force-pushed the promote-help-texts branch from f468f7b to 37a0bd1 Compare August 1, 2023 18:01
changes.
To test you can run `make test`, which will run the `dune` tests (via `make
regtest`) and the formatting consistency check (via `make fmt`). To promote the
`dune` tests and the `ocamlformat --help` output, run `maketest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maketest?


Now, run `dune test`. It will discover your new file and suggest edits to
the generated `tests/passing/dune.inc` file to run your new tests. Run
`dune promote` to update `dune.inc`. This will *not* accept your new tests -- it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does make test really cover all of this? That is, I had to promote twice when adding a new test: once to accept the changes to dune.inc and the next to actually accept the new tests. I haven't experimented, but it looks like make test will not quite do this all in one go. Regardless, I think it's helpful to learn here that dune.inc is generated and how it gets updated.

@goldfirere
Copy link

Closing as abandoned. If anyone thinks this is worthwhile to resurrect, please do so!

@goldfirere goldfirere closed this Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants