DEV Community

COMMENTERTHE9
COMMENTERTHE9

Posted on • Originally published at cx-lang.com

Cx Dev Log — 2026-04-26

The IR backend has entered Phase 11. This shift brings unary expression lowering into the spotlight, with its recent landing on submain introducing negate support for integers and floats alongside boolean not. With four new tests backing up these additions, it echoes more than just syntax tweaks. Meanwhile, behind-the-scenes adjustments continue—an essential cargo test fix rectifies issues left lingering from a prior warning cleanup that had temporarily derailed our test suite. Both of these updates currently reside on submain, leaving the main branch untouched—an evolving situation that keeps many of us watching closely.

Unary Expression Lowering

Diving into unary expression lowering, Phase 11 adds a new match arm to src/ir/lower.rs. We're talking +140/-1 lines, primarily handling two unary operators. First up is Op::Minus. The approach for -x lowering is straightforward: transform it to 0 - x. This approach leverages existing subtraction infrastructure instead of introducing a new Neg IR instruction, maintaining efficiency by keeping the IR instruction set compact. For int and float, it's a matter of producing ConstInt or ConstFloat zero, followed by emitting a Binary::Sub instruction.

For Op::Not, it's all about converting boolean negation into a value == 0 check through a Compare::Eq against zero, returning a Bool. Unsupported operators? They trigger a clean LoweringError instead of causing panic.

To assure robustness, four Rust-level tests map out this action. They don't just check if lowering functions succeed without errors; each test targets the IR's structural output: lowers_unary_negate_int, lowers_unary_negate_float, lowers_unary_not_bool, and rejects_unsupported_unary_op. Although a scoped addition, it marks our shift beyond statement-level constructs, nudging us toward comprehensive expression handling. But note, expressions like ArrayLit, Index, MethodCall, StructLit, HandleVal, HandleDrop, and Range await their turn in the next phases.

Cargo Test Fix

Past oversights in the warning cleanup reform led to a mini disaster—vanishing analyze_program from semantic.rs without updating its lingering test references. As you might imagine, this did not sit well. Commit db2ee08 emerges as the hero, implementing a 27-line test-only wrapper. This wrapper crafts a single-file ResolvedProgram, ensuring analyze_resolved_program continues to run smoothly.

Equally notable is the fixing of CRLF line ending issues across six expected_output files, quelling any lingering mismatches during Windows-based tests. After these revisions, the cargo test suite bounces back to form with 123 passes and one known holdout—an unyielding IR backend test from Phase 10's legacy.

Roadmap v4.8 to v4.9

Our roadmap sees substantive updates. Checkmarks now grace nine hard blockers, substantiated by submain evidence. These cover diverse areas from basic test runners to enforcing integer overflow. All labeled as pending merger to main, sitting patiently for that final nod.

Phase 10 is out of our hair, paving the way for Phase 11's breakthroughs on submain. Known gaps are steadily closing; struct field type checking and integer overflow now find places as resolved on submain. Yet, an undeniable submain integration gap—19 commits ahead of main—looms large.

The Merge Gap

So here we are—the elephant that's commandeering the room. Submain is 19 commits ahead, with a staggering, unchallenged test matrix distinction. Submain's 117/117 stands against main's 78/78. It's the unmerged reality causing a grand chasm of 39 tests between the two. The ever-pending submain-to-main merging remains perched atop our priority list; delays only compound the difficulty of future integrations. Submain's ventures have undeniable value; however, watching its divergence stripe the horizon in bolder strokes daily is concerning.

What's Next

Despite recent efforts, submain-to-main merging and log branch cleanups remain elusive. Yet, moving forward, Phase 11 expression lowering needs to weave through the remaining unsupported kinds: ArrayLit, Index, MethodCall, StructLit, HandleVal, HandleDrop, and Range—prioritizing areas that synergize our approach. On another note, addressing the lone cargo test failure would crown the Rust test suite's fully green visibility. As for the mounting 25 daily-log branches, periodic operational cleanup soon feels imperative.


Follow the Cx language project:

Originally published at https://cx-lang.com/blog/2026-04-26

Top comments (0)