Skip to content

parser: fix comments parsing on map init#18389

Merged
medvednikov merged 1 commit intovlang:masterfrom
felipensp:fix_map_comments
Jun 9, 2023
Merged

parser: fix comments parsing on map init#18389
medvednikov merged 1 commit intovlang:masterfrom
felipensp:fix_map_comments

Conversation

@felipensp
Copy link
Copy Markdown
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
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