Files
hakorune/apps/tests
tomoaki 275fe45ba4 feat(normalization): Phase 142 P0 - Statement-level normalization
## Summary

Changed normalization unit from "block suffix" to "statement (loop only)"
to prevent pattern explosion.

## Changes

1. **PlanBox** (`plan_box.rs`):
   - Always return `loop_only()` for any `loop(true)`, regardless of what follows
   - Subsequent statements (return, assignments) handled by normal MIR lowering
   - ~70 lines reduced, 7 unit tests updated

2. **build_block** (`stmts.rs`):
   - Removed `break` after consumed=1 from suffix_router
   - Continue processing subsequent statements normally
   - Phase 142 P0 comments added

3. **Tests**:
   - Fixture: `phase142_loop_stmt_only_then_return_length_min.hako`
   - VM smoke: exit code 3 (s="abc" → s.length() → 3)

## Results

-  Unit tests: 10/10 passed
-  Phase 142 VM smoke: PASS
-  Phase 131 regression: PASS
-  Build: Success

## Design

- **Pattern Explosion Prevention**: Normalize only the loop (consumed=1)
- **Out-of-Scope Policy**: Always Ok(None) for fallback
- **Fail-Fast**: Only for "in-scope but broken" cases

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-19 04:41:01 +09:00
..

Nyash Test Programs

このディレクトリには、CI/CDやデバッグ用のテストプログラムが含まれています。 実用的なアプリケーションは親ディレクトリ(apps/)にあります。

テストプログラム一覧

LLVMバックエンドテスト

  • ny-llvm-smoke/ - ArrayBox基本操作テスト
  • ny-array-llvm-ret/ - ArrayBox戻り値テスト
  • ny-echo-lite/ - 最小echo実装I/Oテスト
  • ny-map-llvm-smoke/ - MapBoxプラグインテスト
  • ny-vinvoke-smoke/ - 可変長引数5引数テスト
  • ny-vinvoke-llvm-ret/ - 可変長引数戻り値テスト
  • ny-vinvoke-llvm-ret-size/ - 固定長引数size())テスト

実行方法

これらのテストは主に tools/llvm_smoke.sh から実行されます:

# 環境変数でテストを有効化
NYASH_LLVM_MAP_SMOKE=1 ./tools/llvm_smoke.sh
NYASH_LLVM_VINVOKE_RET_SMOKE=1 ./tools/llvm_smoke.sh

注意事項

  • これらは最小限の機能テストであり、実用的なアプリケーションではありません
  • CIでの自動テストを前提に設計されています
  • エラー時の切り分けが容易になるよう、各テストは単一の機能に焦点を当てています