Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #18818
🤖 Generated by Copilot at 7d84ddf
This pull request fixes the C code generation for option types that are passed as mutable parameters to functions. It adds a new type flag
option_mut_param_t
to mark these types and adjusts the C type names, assignments, and string representations accordingly. It also fixes some bugs in the code generation for option expressions and function calls.🤖 Generated by Copilot at 7d84ddf
option_mut_param_t
to mark option types that are passed as mutable parameters or return values (link)memcpy
to copy the right expression to thedata
field of the option struct in assignments (link, link, link)dump_expr
method, which is used for debugging and error reporting (link)parse_param
andparse_return_type
methods invlib/v/parser/fn.v
to set theoption_mut_param_t
flag on option types without any pointer modifiers (link, link)gen_option_type
method invlib/v/gen/c/cgen.v
, since they are already handled by theoption_mut_param_t
flag (link)