cgen: resolve generic map types in concrete contexts#27058
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f2a33280f
ℹ️ 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".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4f2a33280f
ℹ️ 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".
5744b07 to
1ea6bc7
Compare
1ea6bc7 to
7b7400c
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
Is there anything I can do for this PR? |
Summary
Fix C generation for generic map key/value types when a generic struct method is instantiated with multiple concrete types.
The bug showed up when a generic struct owns a map whose value type depends on
T, for examplemap[string]StoredValue[T]. The C backend could reuse stale map key/value types from a previous concrete instantiation, producing mixed C types for differentTs.Changes
if value := map[key]guard variables from the concrete map value type.map[string]Wrapped[T]map[string]Tmap[int]Wrapped[T]map[int]TValidation
./v test vlib/v/tests/generics./v test vlib/v/tests/options/option_map_struct_field_init_test.v./v test vlib/v/tests/concurrency/shared_elem_test.v./v vlib/v/generics/new_generics_regression_test.vgit diff --check