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

Conversation

@alanechang
Copy link

@alanechang alanechang commented Nov 7, 2023

This PR removes the --rewrite-old-style-jane-street-local-annotations flag and enables rewriting with the new syntax by default.

A few consequences of this change are:

  • --erase-jane-syntax now erases the old style local annotation too. See local-erased.ml.ref for differences
  • In order for the AST equality checks to pass when we are modifying the tree deliberately, a new ignore_local_annot_differences option is added to ignore changes around local annotations in the standard AST. This option is set automatically when the legacy syntax is encountered. The alternative here is to convert old local syntax to the new or vice versa during normalization, which is non-trivial and will involve duplicating logic from jane syntax. The standard AST normalization is changed to convert old local syntax into the new syntax in order for the equality check to pass.

@alanechang alanechang force-pushed the aec/remove-local-rewrite-flag branch 2 times, most recently from df7ba4d to 0184a59 Compare November 7, 2023 19:16
@alanechang
Copy link
Author

Removed the logic for erasing legacy local annotation syntax in Fmt_ast.ml and added a note about it in the test:

https://github.com/janestreet/ocamlformat/blob/eceb6382b70e889ef85a86d128caaebd62c756f0/test/passing/tests/local_erased.ml#L1-L5

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>
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>
Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
@alanechang alanechang force-pushed the aec/remove-local-rewrite-flag branch from ffab059 to f458255 Compare November 27, 2023 20:27
Signed-off-by: alanechang <alanechang@janestreet.com>
Signed-off-by: alanechang <alanechang@janestreet.com>
@alanechang
Copy link
Author

@goldfirere Added one more commit to handle the pattern case differently. This fixes an issue caught by the CI tests.

PR should be ready to merge if that commit looks good.

@goldfirere
Copy link

Took a look at that last commit. Looks fine. Let's merge.

@goldfirere goldfirere merged commit c03bb34 into oxcaml:jane Nov 28, 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.

2 participants