Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Preserve declarations after an inactive target item on the same physical line

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

Target preprocessing masks whole physical lines when removing an inactive item. A separate active declaration after the item on the same line is removed too.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

#[target(os="windows")]
fun omitted() {} const KEEP:i32=7;
fun main()->i32{return KEEP;}
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=check
target/debug/wavec --std-root "$PWD/std" build repro.wave --emit=ir --out-dir out

On Linux, both commands reject KEEP as undeclared because the Windows-only function and following const were masked together.

Scope

Stop masking at the actual item boundary and preserve subsequent code, original source coordinates and comment/string handling.

Starting points: front/parser/src/import.rs:1.

Completion criteria

  • [ ] A declaration after an inactive function on the same line remains visible.
  • [ ] Cover representative declaration/import forms and brace/comment/string boundaries.
  • [ ] Keep the inactive item removed and source spans stable.

This is a bounded newcomer task with the starting point and focused negative/positive checks above.

Related: #950, #951, #729. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev