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

json: fix recursive pointer encoding #19840

Merged
merged 1 commit into from
Nov 12, 2023

Conversation

felipensp
Copy link
Member

@felipensp felipensp commented Nov 11, 2023

Fix #19812

🤖 Generated by Copilot at fff005f

This pull request fixes and tests the JSON encoding and decoding of structs with optional and recursive pointer fields in vlib/v/gen/c/json.v and vlib/json. It adds a type check, removes a variable prefix, and creates a new test file vlib/json/json_encode_recursive_ptr_test.v.

🤖 Generated by Copilot at fff005f

  • Fix JSON encoding and decoding of structs with recursive pointer fields (link, link, link)
  • Add a test file vlib/json/json_encode_recursive_ptr_test.v that checks the JSON encoding of a struct with a recursive pointer field of type ?&PostTag (link)
  • Modify the code generation in vlib/v/gen/c/json.v to handle optional fields with pointer types differently from non-pointer types (link)
  • Refactor the code generation in vlib/v/gen/c/json.v to remove the unnecessary res prefix from the variable name that holds the decoded value of the optional field (link)

@felipensp felipensp marked this pull request as ready for review November 11, 2023 12:37
@medvednikov medvednikov merged commit e1312d0 into vlang:master Nov 12, 2023
55 checks passed
@felipensp felipensp deleted the fix_json_ptr_recursive branch November 12, 2023 01:10
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.

cgen error: field expected caused by recursive struct
2 participants