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

Conversation

@dvulakh
Copy link

@dvulakh dvulakh commented Oct 28, 2025

Because of the hacked AST-preservation check, we've been subtly hiding two bugs in jkind normalization in the extended AST:

  1. The extended AST mapper does not traverse jkind annotations on type declarations, so those locations are not erased by the normalizer.
  2. [@@immediate] is rewritten to : immediate during formatting (and not parsing), and the two are not normalized to the same syntax by the extended parsetree normalizer.

The two bugs become more pernicious in the child PR, where the extended AST is alone responsible for normalization of formatted code in comments. Quite a few of our comments involve kind annotations (either exlicitly or as attributes), so I decided to fix.

As a side effect of fixing the mapper, comment association in complex jkinds improves.

Review by commit.

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Signed-off-by: David Vulakh <dvulakh@janestreet.com>
Copy link

@mdelvecchio-jsc mdelvecchio-jsc left a comment

Choose a reason for hiding this comment

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

Looks good.

@@ -0,0 +1,5 @@
(* This is just here so that the std ast normalization fails and we are reliant on the
extended ast *)

Choose a reason for hiding this comment

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

This seems fragile, no?

Copy link
Author

Choose a reason for hiding this comment

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

Replaced with a test that is probably comparably hacky, but should be less brittle.

Signed-off-by: David Vulakh <dvulakh@janestreet.com>
@dvulakh dvulakh merged commit ebd1611 into jane Nov 3, 2025
2 checks passed
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.

3 participants