Skip to content
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

Bug: Formatter is not stabilizing for a small snippet #2527

Closed
tomaz1502 opened this issue Feb 22, 2024 · 3 comments
Closed

Bug: Formatter is not stabilizing for a small snippet #2527

tomaz1502 opened this issue Feb 22, 2024 · 3 comments

Comments

@tomaz1502
Copy link

tomaz1502 commented Feb 22, 2024

Describe the bug
ocamlformat does not stabilize for the following snippet:

(* Does not work *)
ParsingStructureUtilities.exists_in_parsed_function_definition
    is_seq_code_bloc_leaf_has_side_effects (* Check if leaf of sequential code bloc has side effect *)
    is_leaf_has_side_effects (* Check if leaf has side effect *)
    fun_def

However, we can make the formatter work by removing part of the commentaries:

(* Works *)
  ParsingStructureUtilities.exists_in_parsed_function_definition
    is_seq_code_bloc_leaf_has_side_effects (* Check  *)
    is_leaf_has_side_effects (* Check  *)
    fun_def

How to Reproduce
Steps to reproduce the behavior:

  • Start a project with dune init proj foo
  • Place the problematic snippet in a file lib/bug.ml
  • Add the following configuration to the file .ocamlformat:
profile = default
version = 0.26.1
  • Run the command ocamlformat --check lib/bug.ml

Related Issue

#2457

@Julow
Copy link
Collaborator

Julow commented Feb 23, 2024

Thanks for the well written issue! I can reproduce the bug with 0.26.1 and it seems fixed on the main branch, could you confirm ?

@tomaz1502
Copy link
Author

Yes, I confirm!

@Julow
Copy link
Collaborator

Julow commented Feb 23, 2024

Thanks!

@Julow Julow closed this as completed Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants