test(union): regression cases + kernel-parity torture coverage

Four cases in extraction.test.ts: a Rust union carrying an
`impl Trait for` edge and owning the impl's method; a named C union
alongside a forward declaration that must NOT mint a node; a
`typedef union` taking the typedef name with no `<anonymous>` twin; a
C++ union with a member function.

Verified they fail without the fix on BOTH extraction paths — the wasm
walker via CODEGRAPH_KERNEL=0 and the kernel with a staged build.

torture.c / torture.rs gain the same shapes. The parity gate compares
the two walkers rather than a snapshot, so the fixtures do not detect
the bug on their own — they pin that the fix stays SYMMETRIC. The
regression tests above are what pin that it is present.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ctype_lab
2026-08-06 15:47:09 +09:00
co-authored by Claude Opus 5
parent 85e9ac6762
commit 11acc504b5
3 changed files with 133 additions and 0 deletions
@@ -152,3 +152,19 @@ static void ratelimited_warn(void) {
static DEFINE_RATELIMIT_STATE(ratelimit, 5 * HZ, 5);
use_ptr(&ratelimit, 0);
}
/* named union definition, forward declaration, and anonymous typedef union —
the definition is a node, the forward decl is not (#UNION) */
union packet_hdr {
unsigned int raw;
struct { unsigned char ver, flags; } parts;
};
union opaque_hdr;
typedef union {
unsigned int u;
float f;
} word_t;
static unsigned int hdr_raw(union packet_hdr *h) { return h->raw; }
@@ -209,3 +209,10 @@ fn mount() {
}
routes![top_level_h];
pub union Reg {
pub raw: u32,
pub halves: [u16; 2],
}
impl Base for Reg {}