Phase 30.1 & 73: Stage-3 features env and JoinIR flag cleanup
This commit is contained in:
@ -26,8 +26,7 @@ fn phase49_joinir_mainline_pipeline_smoke() {
|
||||
// Phase 49 mainline route は dev フラグで制御
|
||||
std::env::set_var("HAKO_JOINIR_PRINT_TOKENS_MAIN", "1");
|
||||
std::env::set_var("NYASH_JOINIR_MAINLINE_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
// print_tokens を含む最小限の JsonTokenizer 定義
|
||||
@ -77,8 +76,7 @@ static box Main {
|
||||
// クリーンアップ
|
||||
std::env::remove_var("HAKO_JOINIR_PRINT_TOKENS_MAIN");
|
||||
std::env::remove_var("NYASH_JOINIR_MAINLINE_DEBUG");
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -87,8 +85,7 @@ static box Main {
|
||||
fn phase49_joinir_mainline_fallback_without_flag() {
|
||||
// dev フラグ OFF
|
||||
std::env::remove_var("HAKO_JOINIR_PRINT_TOKENS_MAIN");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -128,8 +125,7 @@ static box Main {
|
||||
);
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -166,8 +162,7 @@ static box Main {
|
||||
|
||||
// Route A: Legacy path (flag OFF)
|
||||
std::env::remove_var("HAKO_JOINIR_PRINT_TOKENS_MAIN");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let ast_a: ASTNode =
|
||||
@ -183,9 +178,8 @@ static box Main {
|
||||
let blocks_a: usize = module_a.functions.values().map(|f| f.blocks.len()).sum();
|
||||
|
||||
// Route B: JoinIR Frontend path (flag ON)
|
||||
// Re-set parser flags to ensure they're active
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
// Re-set flags to ensure they're active
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("HAKO_JOINIR_PRINT_TOKENS_MAIN", "1");
|
||||
|
||||
@ -213,8 +207,7 @@ static box Main {
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("HAKO_JOINIR_PRINT_TOKENS_MAIN");
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -229,8 +222,7 @@ fn phase49_joinir_array_filter_smoke() {
|
||||
// Phase 49-4 mainline route は dev フラグで制御
|
||||
std::env::set_var("HAKO_JOINIR_ARRAY_FILTER_MAIN", "1");
|
||||
std::env::set_var("NYASH_JOINIR_MAINLINE_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
// ArrayExtBox.filter 簡易実装(if-in-loop パターン)
|
||||
@ -274,8 +266,7 @@ static box Main {
|
||||
// クリーンアップ
|
||||
std::env::remove_var("HAKO_JOINIR_ARRAY_FILTER_MAIN");
|
||||
std::env::remove_var("NYASH_JOINIR_MAINLINE_DEBUG");
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -284,8 +275,7 @@ static box Main {
|
||||
fn phase49_joinir_array_filter_fallback() {
|
||||
// dev フラグ OFF
|
||||
std::env::remove_var("HAKO_JOINIR_ARRAY_FILTER_MAIN");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -325,8 +315,7 @@ static box Main {
|
||||
);
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -360,8 +349,7 @@ static box Main {
|
||||
|
||||
// Route A: Legacy path (flag OFF)
|
||||
std::env::remove_var("HAKO_JOINIR_ARRAY_FILTER_MAIN");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let ast_a: ASTNode =
|
||||
@ -377,8 +365,7 @@ static box Main {
|
||||
let blocks_a: usize = module_a.functions.values().map(|f| f.blocks.len()).sum();
|
||||
|
||||
// Route B: JoinIR Frontend path (flag ON)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("HAKO_JOINIR_ARRAY_FILTER_MAIN", "1");
|
||||
|
||||
@ -402,7 +389,6 @@ static box Main {
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("HAKO_JOINIR_ARRAY_FILTER_MAIN");
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -307,8 +307,7 @@ impl SnapshotCase {
|
||||
/// ケースに対応する JoinIR JSON を生成
|
||||
fn generate_joinir_json(case: SnapshotCase) -> Option<String> {
|
||||
// Stage-3 parser を有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let src = std::fs::read_to_string(case.source_file()).ok()?;
|
||||
|
||||
@ -463,8 +462,7 @@ use crate::mir::join_ir_vm_bridge::convert_joinir_to_mir;
|
||||
#[test]
|
||||
fn joinir_stageb_body_structure_test() {
|
||||
// Stage-3 parser を有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let src = match std::fs::read_to_string("apps/tests/stageb_body_extract_minimal.hako") {
|
||||
Ok(s) => s,
|
||||
@ -552,8 +550,7 @@ fn joinir_stageb_body_structure_test() {
|
||||
#[test]
|
||||
fn joinir_stageb_funcscanner_structure_test() {
|
||||
// Stage-3 parser を有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let src = match std::fs::read_to_string("apps/tests/stageb_funcscanner_scan_boxes_minimal.hako")
|
||||
{
|
||||
|
||||
@ -28,8 +28,7 @@ fn joinir_runner_minimal_skip_ws_executes() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
// 無限ループ検出のため、実験テストではステップ上限を小さめに設定しておく。
|
||||
// 0 は「上限なし」なので、ここでは明示的な上限を使う。
|
||||
@ -75,8 +74,7 @@ static box Runner {
|
||||
other => panic!("JoinIR runner returned non-int value: {:?}", other),
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
std::env::remove_var("NYASH_VM_MAX_STEPS");
|
||||
}
|
||||
@ -88,8 +86,7 @@ fn joinir_runner_funcscanner_trim_executes() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
@ -137,8 +134,7 @@ static box Runner {
|
||||
other => panic!("JoinIR runner returned non-string value: {:?}", other),
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_ENABLE_USING");
|
||||
std::env::remove_var("HAKO_ENABLE_USING");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
|
||||
@ -35,8 +35,7 @@ fn joinir_vm_bridge_skip_ws_matches_direct_vm() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("NYASH_VM_MAX_STEPS", "100000");
|
||||
|
||||
@ -97,8 +96,7 @@ static box Runner {
|
||||
other => panic!("JoinIR VM bridge returned non-int value: {:?}", other),
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
std::env::remove_var("NYASH_VM_MAX_STEPS");
|
||||
}
|
||||
|
||||
@ -109,8 +109,7 @@ fn joinir_vm_bridge_stage1_usingresolver_empty_entries() {
|
||||
}
|
||||
|
||||
// Stage-3 parser 有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("NYASH_VM_MAX_STEPS", "100000");
|
||||
|
||||
@ -181,8 +180,7 @@ fn joinir_vm_bridge_stage1_usingresolver_empty_entries() {
|
||||
);
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
std::env::remove_var("NYASH_VM_MAX_STEPS");
|
||||
}
|
||||
@ -195,8 +193,7 @@ fn joinir_vm_bridge_stage1_usingresolver_with_entries() {
|
||||
}
|
||||
|
||||
// 環境変数を各テストで再設定(並列テスト対策)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("NYASH_VM_MAX_STEPS", "100000");
|
||||
|
||||
@ -252,8 +249,7 @@ fn joinir_vm_bridge_stage1_usingresolver_with_entries() {
|
||||
eprintln!("[joinir_vm_bridge_test/stage1] ✅ With entries test passed");
|
||||
|
||||
// クリーンアップ
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
std::env::remove_var("NYASH_VM_MAX_STEPS");
|
||||
}
|
||||
@ -267,8 +263,7 @@ fn joinir_vm_bridge_stage1_usingresolver_route_b_execution() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let full_src = format!("{STAGE1_USINGRESOLVER_SOURCE}\n{RUNNER_SOURCE}");
|
||||
@ -333,8 +328,7 @@ fn joinir_vm_bridge_stage1_usingresolver_route_b_execution() {
|
||||
}
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -347,8 +341,7 @@ fn joinir_vm_bridge_stage1_usingresolver_route_b_with_entries() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let full_src = format!("{STAGE1_USINGRESOLVER_SOURCE}\n{RUNNER_WITH_ENTRIES_SOURCE}");
|
||||
@ -421,8 +414,7 @@ fn joinir_vm_bridge_stage1_usingresolver_route_b_with_entries() {
|
||||
}
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -431,8 +423,7 @@ fn joinir_vm_bridge_stage1_usingresolver_lowering_sanity() {
|
||||
// 常時実行:lowering が正しく動作するかの基本検証
|
||||
// (実行はしない、構造のみ確認)
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let full_src = format!("{STAGE1_USINGRESOLVER_SOURCE}\n{RUNNER_SOURCE}");
|
||||
|
||||
@ -454,6 +445,5 @@ fn joinir_vm_bridge_stage1_usingresolver_lowering_sanity() {
|
||||
let jm = join_module.unwrap();
|
||||
assert_eq!(jm.functions.len(), 2, "Expected 2 JoinIR functions");
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
}
|
||||
|
||||
@ -71,8 +71,7 @@ fn joinir_vm_bridge_trim_matches_direct_vm() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
std::env::set_var("NYASH_VM_MAX_STEPS", "100000");
|
||||
|
||||
@ -137,8 +136,7 @@ static box Runner {
|
||||
other => panic!("JoinIR VM bridge returned non-string value: {:?}", other),
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
std::env::remove_var("NYASH_VM_MAX_STEPS");
|
||||
}
|
||||
@ -150,8 +148,7 @@ fn joinir_vm_bridge_trim_edge_cases() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
// Test cases: (input, expected_output)
|
||||
@ -168,8 +165,7 @@ fn joinir_vm_bridge_trim_edge_cases() {
|
||||
for (input, expected) in test_cases {
|
||||
// Re-set environment variables at each iteration to avoid race conditions
|
||||
// with parallel test execution
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
|
||||
let runner = format!(
|
||||
@ -215,7 +211,6 @@ static box Runner {{
|
||||
}
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
}
|
||||
|
||||
@ -41,8 +41,7 @@ fn mir_joinir_funcscanner_append_defs_auto_lowering() {
|
||||
// Step 1: MIR までコンパイル
|
||||
// Phase 27.14: Minimal .hako file to avoid complex dependencies
|
||||
// Stage-3 parser を有効化(local キーワード対応)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/funcscanner_append_defs_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
@ -181,8 +180,7 @@ fn mir_joinir_funcscanner_append_defs_generic_matches_handwritten() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/funcscanner_append_defs_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -10,11 +10,10 @@
|
||||
// - デフォルトでは #[ignore] にしておいて手動実行用にする
|
||||
// - 環境変数 NYASH_JOINIR_EXPERIMENT=1 で実験モード有効化
|
||||
//
|
||||
// Phase 27.4-C 対応:
|
||||
// Phase 27.4-C 対応(現状メモのみ):
|
||||
// - このテストは JoinIR 変換のみを検証(VM 実行なし)
|
||||
// - NYASH_JOINIR_HEADER_EXP=1 を併用すると Header φ bypass が有効化される
|
||||
// - bypass 時は MIR に Header φ が生成されないが、このテストでは JoinIR のみ検証するため問題なし
|
||||
// - 将来的に JoinIR runner 実行を追加する際は、bypass モードでも正しく動作することを確認する
|
||||
// - かつては Header φ bypass を有効化する JoinIR 実験フラグがあったが、
|
||||
// Phase 73 時点では削除済み(常時 OFF)となっている。
|
||||
//
|
||||
// Phase 27.5 対応:
|
||||
// - このテストは Header φ だけでなく、Exit φ(e の合流+substring(b, e) 呼び出し)も JoinIR で k_exit として表現できることを検証
|
||||
@ -39,8 +38,7 @@ fn mir_joinir_funcscanner_trim_auto_lowering() {
|
||||
}
|
||||
|
||||
// Stage-3 parser を有効化(local キーワード対応)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
|
||||
@ -137,8 +135,6 @@ fn mir_joinir_funcscanner_trim_generic_matches_handwritten() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
|
||||
|
||||
@ -129,7 +129,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_if_select_pattern_matching() {
|
||||
// ==== 1. Simple pattern (env ON) ====
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
let func = create_simple_pattern_mir();
|
||||
let entry_block = func.entry_block;
|
||||
@ -185,21 +185,18 @@ mod tests {
|
||||
}
|
||||
|
||||
// ==== 3. Disabled by default (env OFF) ====
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
|
||||
let func = create_simple_pattern_mir();
|
||||
let entry_block = func.entry_block;
|
||||
let result = try_lower_if_to_joinir(&func, entry_block, false, None); // Phase 61-1: Pure If
|
||||
|
||||
assert!(
|
||||
result.is_none(),
|
||||
"Expected None when NYASH_JOINIR_IF_SELECT is not set"
|
||||
);
|
||||
assert!(result.is_none(), "Expected None when IfSelect toggle is not set");
|
||||
|
||||
eprintln!("✅ If/Select lowering correctly disabled by default");
|
||||
|
||||
// ==== 4. Wrong function name (env ON) ====
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
let mut func = create_simple_pattern_mir();
|
||||
func.signature.name = "WrongName.test/1".to_string();
|
||||
@ -214,7 +211,7 @@ mod tests {
|
||||
eprintln!("✅ Function name filter working correctly");
|
||||
|
||||
// Clean up
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@ -520,7 +517,7 @@ mod tests {
|
||||
fn test_if_merge_simple_pattern() {
|
||||
use crate::mir::join_ir::JoinInst;
|
||||
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
let func = create_if_merge_simple_pattern_mir();
|
||||
let entry_block = func.entry_block;
|
||||
@ -553,7 +550,7 @@ mod tests {
|
||||
panic!("Expected JoinInst::IfMerge, got {:?}", result);
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
}
|
||||
|
||||
/// Phase 33-7: Test IfMerge lowering for 3-variable pattern
|
||||
@ -561,7 +558,7 @@ mod tests {
|
||||
fn test_if_merge_multiple_pattern() {
|
||||
use crate::mir::join_ir::JoinInst;
|
||||
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
let func = create_if_merge_multiple_pattern_mir();
|
||||
let entry_block = func.entry_block;
|
||||
@ -594,7 +591,7 @@ mod tests {
|
||||
panic!("Expected JoinInst::IfMerge, got {:?}", result);
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
}
|
||||
|
||||
/// Phase 63-2: Helper to create a simple pattern MIR with Const instructions
|
||||
@ -656,7 +653,7 @@ mod tests {
|
||||
fn test_type_hint_propagation_simple() {
|
||||
use crate::mir::MirType;
|
||||
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
let func = create_simple_pattern_mir_with_const();
|
||||
let entry_block = func.entry_block;
|
||||
@ -681,7 +678,7 @@ mod tests {
|
||||
panic!("Expected Select instruction with type_hint");
|
||||
}
|
||||
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
}
|
||||
|
||||
/// Phase 63-6-4: A/B テスト - Route A (legacy) vs Route B (type hint)
|
||||
@ -693,7 +690,7 @@ mod tests {
|
||||
fn test_p1_ab_type_inference() {
|
||||
use crate::mir::MirType;
|
||||
|
||||
std::env::set_var("NYASH_JOINIR_IF_SELECT", "1");
|
||||
std::env::set_var("HAKO_JOINIR_IF_SELECT", "1");
|
||||
|
||||
// P1 Simple pattern で Select 生成
|
||||
let func = create_simple_pattern_mir_with_const();
|
||||
@ -720,7 +717,7 @@ mod tests {
|
||||
eprintln!("✅ Phase 63-6-4 Step 2: P1 function name filter: IfSelectTest.* ✓");
|
||||
eprintln!("✅ Phase 63-6-4: A/B test passed - JoinIR type hint available for lifecycle.rs");
|
||||
|
||||
std::env::remove_var("NYASH_JOINIR_IF_SELECT");
|
||||
std::env::remove_var("HAKO_JOINIR_IF_SELECT");
|
||||
}
|
||||
|
||||
/// Phase 64-2-2: A/B テスト - P2 IfMerge Simple 型ヒント検証
|
||||
|
||||
@ -31,8 +31,7 @@ fn mir_joinir_min_manual_construction() {
|
||||
|
||||
// Step 1: MIR までコンパイル(既存パイプラインで)
|
||||
// Stage-3 環境変数を設定(local キーワード対応)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/joinir_min_loop.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
@ -148,8 +147,7 @@ fn mir_joinir_min_auto_lowering() {
|
||||
}
|
||||
|
||||
// Step 1: MIR までコンパイル
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/joinir_min_loop.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -10,11 +10,10 @@
|
||||
// - デフォルトでは #[ignore] にしておいて手動実行用にする
|
||||
// - 環境変数 NYASH_JOINIR_EXPERIMENT=1 で実験モード有効化
|
||||
//
|
||||
// Phase 27.4-C 対応:
|
||||
// Phase 27.4-C 対応(現状メモのみ):
|
||||
// - このテストは JoinIR 変換のみを検証(VM 実行なし)
|
||||
// - NYASH_JOINIR_HEADER_EXP=1 を併用すると Header φ bypass が有効化される
|
||||
// - bypass 時は MIR に Header φ が生成されないが、このテストでは JoinIR のみ検証するため問題なし
|
||||
// - 将来的に JoinIR runner 実行を追加する際は、bypass モードでも正しく動作することを確認する
|
||||
// - かつては Header φ bypass を有効化する JoinIR 実験フラグがあったが、
|
||||
// Phase 73 時点では削除済み(常時 OFF)となっている。
|
||||
//
|
||||
// Phase 27.5 対応:
|
||||
// - このテストは Header φ だけでなく、Exit φ(i の合流)も JoinIR で k_exit(i) として表現できていることを検証
|
||||
@ -41,8 +40,7 @@ fn mir_joinir_skip_ws_auto_lowering() {
|
||||
|
||||
// Step 1: MIR までコンパイル
|
||||
// Stage-3 parser を有効化(local キーワード対応)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/minimal_ssa_skip_ws.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
@ -129,8 +127,7 @@ fn mir_joinir_skip_ws_generic_matches_handwritten() {
|
||||
}
|
||||
|
||||
// Stage-3 parserを有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/minimal_ssa_skip_ws.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -41,8 +41,7 @@ fn mir_joinir_stage1_using_resolver_auto_lowering() {
|
||||
// Step 1: MIR までコンパイル
|
||||
// Phase 27.13: Minimal .hako file to avoid `using` statement parser issues
|
||||
// Stage-3 parser を有効化(local キーワード対応)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/stage1_usingresolver_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
@ -152,8 +151,7 @@ fn mir_joinir_stage1_using_resolver_generic_matches_handwritten() {
|
||||
return;
|
||||
}
|
||||
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/stage1_usingresolver_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -25,8 +25,7 @@ fn mir_joinir_stageb_body_auto_lowering() {
|
||||
}
|
||||
|
||||
// Stage-3 パーサを有効化(local/loop を安全に扱うため)
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/stageb_body_extract_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -23,8 +23,7 @@ fn mir_joinir_stageb_funcscanner_auto_lowering() {
|
||||
}
|
||||
|
||||
// Stage-3 パーサを有効化
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
|
||||
let test_file = "apps/tests/stageb_funcscanner_scan_boxes_minimal.hako";
|
||||
let src = std::fs::read_to_string(test_file)
|
||||
|
||||
@ -10,16 +10,14 @@ use crate::mir::{MirCompiler, MirVerifier};
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
fn setup_stage3_env() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
}
|
||||
|
||||
fn teardown_stage3_env() {
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_ENABLE_USING");
|
||||
std::env::remove_var("HAKO_ENABLE_USING");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
|
||||
@ -8,16 +8,14 @@ use crate::mir::{MirCompiler, MirVerifier};
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
fn setup_stage3_env() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
std::env::set_var("NYASH_DISABLE_PLUGINS", "1");
|
||||
}
|
||||
|
||||
fn teardown_stage3_env() {
|
||||
std::env::remove_var("NYASH_PARSER_STAGE3");
|
||||
std::env::remove_var("HAKO_PARSER_STAGE3");
|
||||
std::env::remove_var("NYASH_FEATURES");
|
||||
std::env::remove_var("NYASH_ENABLE_USING");
|
||||
std::env::remove_var("HAKO_ENABLE_USING");
|
||||
std::env::remove_var("NYASH_DISABLE_PLUGINS");
|
||||
|
||||
@ -14,7 +14,7 @@ fn test_loopform_exit_phi_single_break() {
|
||||
// Enable MIR verification and debug traces
|
||||
std::env::set_var("NYASH_VM_VERIFY_MIR", "1");
|
||||
std::env::set_var("NYASH_LOOPFORM_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -76,7 +76,7 @@ fn test_loopform_exit_phi_multiple_breaks() {
|
||||
// LoopForm PHI v2 はデフォルト実装(フラグ不要)
|
||||
std::env::set_var("NYASH_VM_VERIFY_MIR", "1");
|
||||
std::env::set_var("NYASH_LOOPFORM_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -114,7 +114,7 @@ fn test_loopform_exit_phi_nested_if_break() {
|
||||
// LoopForm PHI v2 はデフォルト実装(フラグ不要)
|
||||
std::env::set_var("NYASH_VM_VERIFY_MIR", "1");
|
||||
std::env::set_var("NYASH_LOOPFORM_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -157,7 +157,6 @@ fn test_loopform_exit_phi_multiple_vars() {
|
||||
// LoopForm PHI v2 はデフォルト実装(フラグ不要)
|
||||
std::env::set_var("NYASH_VM_VERIFY_MIR", "1");
|
||||
std::env::set_var("NYASH_LOOPFORM_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
|
||||
let src = r#"
|
||||
@ -203,7 +202,6 @@ static box TestMultiVars {
|
||||
fn test_loop_scope_env_carrier_and_invariant() {
|
||||
std::env::set_var("NYASH_VM_VERIFY_MIR", "1");
|
||||
std::env::set_var("NYASH_LOOPFORM_DEBUG", "1");
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
|
||||
let src = r#"
|
||||
|
||||
@ -5,8 +5,7 @@ use crate::mir::{instruction::MirInstruction, types::CompareOp, MirCompiler, Mir
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
fn ensure_stage3_env() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
// このフィクスチャは静的 box Stage1Cli を新規に定義するため、
|
||||
|
||||
@ -5,8 +5,7 @@ use crate::parser::NyashParser;
|
||||
#[test]
|
||||
fn mir_stage1_cli_stage1_main_compiles_and_verifies() {
|
||||
// Stage‑3 + using を有効化して stage1_cli.hako をそのままパースする。
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
|
||||
@ -30,8 +30,7 @@ use crate::mir::{instruction::MirInstruction, MirCompiler, MirVerifier};
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
fn ensure_stage3_env() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("HAKO_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ use crate::mir::{MirCompiler, MirVerifier};
|
||||
use crate::parser::NyashParser;
|
||||
|
||||
fn ensure_stage3_env() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
|
||||
@ -8,7 +8,7 @@ use crate::parser::NyashParser;
|
||||
#[test]
|
||||
fn mir_stage1_cli_entry_like_pattern_verifies() {
|
||||
// Enable Stage‑3 and using so the parser accepts modern syntax.
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
@ -51,7 +51,7 @@ static box Stage1CliEntryLike {
|
||||
/// Shape test: env-only の最小ディスパッチャで SSA/PHI 崩れない形を固定する。
|
||||
#[test]
|
||||
fn mir_stage1_cli_stage1_main_shape_verifies() {
|
||||
std::env::set_var("NYASH_PARSER_STAGE3", "1");
|
||||
std::env::set_var("NYASH_FEATURES", "stage3");
|
||||
std::env::set_var("NYASH_PARSER_ALLOW_SEMICOLON", "1");
|
||||
std::env::set_var("NYASH_ENABLE_USING", "1");
|
||||
std::env::set_var("HAKO_ENABLE_USING", "1");
|
||||
|
||||
Reference in New Issue
Block a user