Files
isaac 90b2ba0bd4 SwiftTL: avoid trap when flags field fails to parse
Generated parse_<ctor>(...) for constructors with conditional fields
used to emit 'if Int(_N!) & Int(1 << K) != 0 { ... }' as the gate,
and 'let _cM = (Int(_N!) & Int(1 << K) == 0) || _M != nil' as the
per-field validation. Both force-unwrap _N (the flags field read)
before the bottom-of-function '_cN = _N != nil' validation runs,
so a buffer short enough to fail the flags read traps
deterministically instead of returning nil.

Replace the force-unwraps with (_N ?? 0). Missing flags then reads
as "all bits off": every gated branch is skipped, each flag-gated
_cM short-circuits to true via the '== 0' clause, and the flags
field's own _cN = _N != nil still fails so the overall constructor
validation falls through to return nil — matching the intended
"return nil on truncated buffer" contract.

Touches both generator emit paths (flat generateImplFile and layered
emitLayeredType). Regenerated Api*/SecretApiLayer*.swift follow in a
separate commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 23:44:26 +04:00
..
2026-03-30 20:44:10 +08:00
2026-03-13 09:00:55 +01:00
2025-12-26 19:42:31 +08:00
2025-09-12 10:55:11 +02:00
2025-12-10 00:16:36 +08:00
2025-03-30 02:06:26 +04:00
2025-01-28 20:58:35 +04:00
2022-05-02 16:40:58 +04:00
2022-08-09 12:37:00 +04:00
2021-07-21 20:03:38 +02:00
2025-07-01 14:57:33 +02:00
2020-03-25 17:59:03 +04:00
2022-05-13 05:30:49 +04:00