feat(joinir): Phase 185 Strict Mode Semantics Cleanup

Remove redundant strict checks from If lowering (3 → 1 check point):
- mod.rs: Remove 2 strict panic blocks from try_lower_if_to_joinir()
- mod.rs: Comment out unused strict_on variable
- Keep single strict check at caller level (if_form.rs)

This aligns If lowering architecture with Loop lowering:
- Lowerers are thin Result-returning boxes (no policy decisions)
- Strict mode check happens at router/caller level (single source of truth)
- Fail-Fast principle: panic at ONE location when strict=ON

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-04 22:27:12 +09:00
parent d9e91d4228
commit 6561832545
2 changed files with 60 additions and 16 deletions

View File

@ -202,7 +202,8 @@ pub fn try_lower_if_to_joinir(
return None;
}
let core_on = crate::config::env::joinir_core_enabled();
let strict_on = crate::config::env::joinir_strict_enabled();
// Phase 185: strict check moved to caller (if_form.rs)
// let strict_on = crate::config::env::joinir_strict_enabled();
// Phase 33-9.1: Loop専任関数の除外Loop/If責務分離
// Loop lowering対象関数はIf loweringの対象外にすることで、
@ -248,7 +249,7 @@ pub fn try_lower_if_to_joinir(
return None;
}
}
let strict_allowed = strict_on && core_on && is_allowed;
// Phase 185: strict_allowed removed (strict check moved to caller: if_form.rs)
if debug_level >= 1 {
eprintln!(
@ -286,6 +287,8 @@ pub fn try_lower_if_to_joinir(
if_select::IfSelectLowerer::new(debug_level)
};
// Phase 185: Remove strict checks from lowerer (thin Result-returning box)
// Strict mode panic should happen at caller level (if_form.rs), not here
if !if_select_lowerer.can_lower_to_select(func, block_id) {
if debug_level >= 1 {
eprintln!(
@ -293,12 +296,6 @@ pub fn try_lower_if_to_joinir(
func.signature.name
);
}
if strict_allowed {
panic!(
"[joinir/if] strict mode: pattern not matched for {}",
func.signature.name
);
}
return None;
}
@ -311,13 +308,6 @@ pub fn try_lower_if_to_joinir(
);
}
if result.is_none() && strict_allowed {
panic!(
"[joinir/if] strict mode: lowering failed for {}",
func.signature.name
);
}
result
}