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

fmt: keep anon struct decl fields in interfaces #19461

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

Delta456
Copy link
Member

@Delta456 Delta456 commented Sep 28, 2023

Closes #19459

🤖 Generated by Copilot at d7fe90f

Add support for anonymous structs inside interfaces in the V language. Modify vlib/v/fmt/fmt.v to format such declarations correctly and add a test file vlib/v/fmt/tests/interface_anon_struct_decl_keep.vv.

🤖 Generated by Copilot at d7fe90f

  • Add support for anonymous structs inside interfaces (link, link)
    • Modify write_struct_decl method of Fmt struct in vlib/v/fmt/fmt.v to check for anonymous struct fields and write them using write_anon_struct_field_decl method (link)
    • Add write_anon_struct_field_decl method to Fmt struct in vlib/v/fmt/fmt.v to write the field name and the struct declaration for anonymous struct fields (link)
    • Add test file vlib/v/fmt/tests/interface_anon_struct_decl_keep.vv to define an interface with an anonymous struct field and check that the formatter keeps the struct declaration as it is (link)

@spytheman spytheman force-pushed the fmt_interface_anon_struct branch from 1b2cb3b to 7a78914 Compare September 28, 2023 11:33
@spytheman
Copy link
Member

(rebased over master)

@spytheman spytheman merged commit 9a03e18 into vlang:master Sep 28, 2023
@Delta456 Delta456 deleted the fmt_interface_anon_struct branch September 28, 2023 16:55
Wertzui123 pushed a commit to Wertzui123/v that referenced this pull request Oct 8, 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.

vfmt replaces anonymous struct in interface with _VAnonStruct1
2 participants