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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

parser: fix comments parsing on map init #18389

Merged
merged 1 commit into from Jun 9, 2023

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Jun 9, 2023

Fix #18362

馃 Generated by Copilot at afb82d0

This pull request fixes a bug in the parser and the formatter that caused comments inside map initialization expressions to be deleted. It also adds a test case in vlib/v/fmt/tests/map_init_comments_keep.vv to verify the correct behavior.

馃 Generated by Copilot at afb82d0

  • Preserve comments inside map initialization expressions in the parser and formatter (link, link)
    • Check p.inside_map_init flag before eating comments in p.expr() (link)
    • Add a test case in vlib/v/fmt/tests/map_init_comments_keep.vv to show that comments after the colon are kept, but comments after the comma are deleted (link)

@felipensp felipensp marked this pull request as ready for review June 9, 2023 17:52
@medvednikov medvednikov merged commit 3e5f254 into vlang:master Jun 9, 2023
50 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.

parser: missing comments, fmt removes comments between fields in map init with enum keys
2 participants