wcc+selfhost: pkg-qualified enum access (os.whence.CUR)

Driver-side concatenation flattens module names, but enum member
lookup keyed off the exact lhs ident — so `whence.CUR` worked while
`os.whence.CUR` fell through to w6l with `undefined main.whence`.

C side: fold TY_ENUM members in the post-cexpr cascade too, not
just the early SK_TYPE shortcut. The recursive cexpr lands the
inner N_DOT(os, whence) on the named enum type; the outer access
then folds normally.

Selfhost: cgdot now treats `N_IDENT.MEMBER` and `N_DOT.MEMBER` the
same way, keying off the leaf name. enumlookup strips a trailing
`.`-prefix from the lookup key.

Adds e2e test 700: `use os; os.whence.CUR as i32 == 1`.
This commit is contained in:
2026-05-12 04:30:20 +09:00
parent f597ce67f6
commit 5149d10618
6 changed files with 120 additions and 12 deletions

View File

@@ -1100,6 +1100,13 @@ static const struct row rows[] = {
" let m: mode = mode.R | mode.W;\n"
" return m as i32;\n"
"};", 3 },
/* enum: pkg-qualified access — `os.whence.CUR` resolves through
* SK_USE and folds to the member literal. */
{ "// MODULE: os\n"
"type whence = enum { SET, CUR, END };\n"
"// MODULE: main\n"
"use os;\n"
"fn main() i32 = { return os.whence.CUR as i32; };", 1 },
{ NULL, 0 }
};