Files
hakorune/tools
nyash-codex c8bbe389da test(compiler): add Stage-B minimal SSA test harness
**Goal**: Create 100-line minimal test case to reproduce SSA/ValueId
bugs in Stage-B compilation without the complexity of full compiler_stageb.hako.

**Files added**:

1. **lang/src/compiler/tests/stageb_min_sample.hako** (65 lines)
   - Pattern 1: Method call in if-block before loop (TestArgs.process)
   - Pattern 2: Simple method calls without loops (TestSimple.run)
   - Pattern 3: Nested if/loop with method calls (TestNested.complex)
   - All patterns reproduce ValueId SSA bugs

2. **tools/test_stageb_min.sh** (executable test script)
   - Test 1: Direct VM execution
   - Test 2: Stage-B compilation pipeline
   - Test 3: MIR verification

**Test results** (as of commit):

Test 1 (Direct VM):
```
 ValueId(14) error in TestArgs.process/1
   (different from ValueId(17) in Stage-B!)
```

Test 2 (Stage-B):
```
 ValueId(17) error in StageBArgsBox.resolve_src/1
   (expected, same as full compiler_stageb.hako)
```

Test 3 (MIR verification):
```
 No verification errors
   (verifier doesn't catch these specific SSA bugs)
```

**Findings**:
- Multiple ValueId SSA bugs exist (14, 17, etc.)
- MIR verifier needs enhancement to catch receiver use-before-def
- Minimal harness successfully reproduces issues for easier debugging

**Next steps** (not in this commit):
- Fix ValueId(14) in TestArgs.process
- Fix ValueId(17) in StageBArgsBox.resolve_src
- Enhance MIR verifier to catch Method receiver SSA bugs

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 04:29:10 +09:00
..