Skip to content

lifetimes#26859

Open
medvednikov wants to merge 5 commits intomasterfrom
lifetimes
Open

lifetimes#26859
medvednikov wants to merge 5 commits intomasterfrom
lifetimes

Conversation

@medvednikov
Copy link
Copy Markdown
Member

Summary

  • Add lifetime tracking to v2 compiler: parser, type checker, transformer, and code generators
  • Implement clone() auto-generation for structs with heap-allocated fields
  • Extend ownership analysis with lifetime-aware transformations and diagnostics
  • Fix -cstrict build: cast _dyld_get_image_header() return to voidptr in backtraces
  • Improve v2 recompilation detection to watch both cmd/v2/ and vlib/v2/ directories

Test plan

  • Transformer tests pass (transformer_test.v)
  • Checker tests pass (checker_test.v)
  • v -cg -cstrict -o vstrict1 cmd/v builds without errors

🤖 Generated with Claude Code

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a1c370c58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +77 to +79
if fn_name.starts_with('${module_name}__') {
return fn_name
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve module prefix in generated fn scope keys

Do not strip the module prefix from generated function scope keys here. register_needed_option_clone can emit names like builtin__Option_string__clone, but transformer/fn.v and Environment.get_fn_scope still look up scopes as ${module}__${fn_name}. With this branch, those helpers are stored under a different key, so generated clone helpers in non-main/builtin modules miss parameter type scope; the synthetic if value := s in option clone generation is then treated as a plain condition and can lower to if (s) (invalid for option structs in C). A simple trigger is cloning a struct that contains ?string.

Useful? React with 👍 / 👎.

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.

1 participant