Ver Fonte

docs(union): changelog entry + port-checklist annotations

The two kernel port checklists record the extractor configs as surveyed
at porting time; their structTypes lines are marked superseded rather
than rewritten, so the surveys stay readable as history.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ctype_lab há 1 mês atrás
pai
commit
86854cd0d7

+ 2 - 0
CHANGELOG.md

@@ -17,6 +17,8 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 
 ### Fixes
 ### Fixes
 
 
+- Unions are now indexed in C, C++, Objective-C and Rust. A `union` declaration previously produced no symbol at all, so it never appeared in search or `codegraph_explore`, and anything attached to it disappeared with it — in Rust, every `impl SomeTrait for MyUnion` lost its edge, and the methods from that impl were left pointing at a type the graph did not contain. A `typedef union { … } Name;` in C now carries the typedef's name like `typedef struct` already did. Re-index after upgrading to pick up the new symbols.
+
 - `codegraph_explore` now concentrates its answer on the code that actually answers your question instead of spreading it across files that merely share a word with it, so more of the answer arrives in a single call. Thanks @LeDuyViet for the detailed measurements and reproduction. (#1500)
 - `codegraph_explore` now concentrates its answer on the code that actually answers your question instead of spreading it across files that merely share a word with it, so more of the answer arrives in a single call. Thanks @LeDuyViet for the detailed measurements and reproduction. (#1500)
 - Files only weakly related to your question now come back as a name, symbol and line number instead of spending the answer on their source — name one of them in a follow-up `codegraph_explore` to get it back in full. (#1500)
 - Files only weakly related to your question now come back as a name, symbol and line number instead of spending the answer on their source — name one of them in a follow-up `codegraph_explore` to get it back in full. (#1500)
 - A generated CRUD or protobuf layer no longer crowds out the hand-written code sitting beside it: generated files are now recognized by the `// Code generated by … DO NOT EDIT.` style banner written at the top of the file, not just by a filename that looks generated. Re-index after upgrading to pick up the new detection. (#1500)
 - A generated CRUD or protobuf layer no longer crowds out the hand-written code sitting beside it: generated files are now recognized by the `// Code generated by … DO NOT EDIT.` style banner written at the top of the file, not just by a filename that looks generated. Re-index after upgrading to pick up the new detection. (#1500)

+ 4 - 1
docs/design/ccpp-kernel-port-checklist.md

@@ -139,7 +139,10 @@ walker mirrors, with file:line anchors (as of `705e501`). Read WITH
 ## Extractor configs (languages/c-cpp.ts — read the whole file when porting)
 ## Extractor configs (languages/c-cpp.ts — read the whole file when porting)
 
 
 **cExtractor (line 180):** functionTypes=[function_definition]; NO
 **cExtractor (line 180):** functionTypes=[function_definition]; NO
-class/method/interface types; structTypes=[struct_specifier];
+class/method/interface types; structTypes=[struct_specifier]
+(superseded: `union_specifier` joined structTypes — a named `union U { … };`
+is a definition, extracted with kind `struct`, and `typedef union { … } N;`
+resolves through resolveTypeAliasKind like `typedef struct`);
 enumTypes=[enum_specifier]; enumMemberTypes=[enumerator];
 enumTypes=[enum_specifier]; enumMemberTypes=[enumerator];
 typeAliasTypes=[type_definition]; importTypes=[preproc_include];
 typeAliasTypes=[type_definition]; importTypes=[preproc_include];
 callTypes=[call_expression]; variableTypes=[declaration];
 callTypes=[call_expression]; variableTypes=[declaration];

+ 3 - 1
docs/design/rust-lang-kernel-port-checklist.md

@@ -54,7 +54,9 @@ Types: functionTypes=[`function_item`, **`function_signature_item`**] (the
 latter = a trait method DECLARATION `fn render(&self);` — extracted so a
 latter = a trait method DECLARATION `fn render(&self);` — extracted so a
 trait's method set is first-class); classTypes=[] (impl blocks instead);
 trait's method set is first-class); classTypes=[] (impl blocks instead);
 methodTypes = same two; interfaceTypes=[`trait_item`] with
 methodTypes = same two; interfaceTypes=[`trait_item`] with
-**interfaceKind:'trait'**; structTypes=[`struct_item`]; enumTypes=[`enum_item`];
+**interfaceKind:'trait'**; structTypes=[`struct_item`] (superseded:
+`union_item` joined structTypes — same `body` field, same extractor, kind
+`struct`); enumTypes=[`enum_item`];
 enumMemberTypes=[`enum_variant`]; typeAliasTypes=[`type_item`];
 enumMemberTypes=[`enum_variant`]; typeAliasTypes=[`type_item`];
 importTypes=[`use_declaration`]; callTypes=[`call_expression`];
 importTypes=[`use_declaration`]; callTypes=[`call_expression`];
 variableTypes=[`let_declaration`, `const_item`, `static_item`].
 variableTypes=[`let_declaration`, `const_item`, `static_item`].