phase29ai(p15): observe pattern2 promotion hint under strict
This commit is contained in:
@ -7,8 +7,11 @@ use crate::mir::builder::control_flow::joinir::patterns::router::LoopPatternCont
|
||||
use crate::mir::loop_pattern_detection::LoopPatternKind;
|
||||
|
||||
use super::legacy_rules;
|
||||
use crate::mir::builder::control_flow::plan::facts::pattern2_loopbodylocal_facts::{
|
||||
try_extract_pattern2_loopbodylocal_facts, LoopBodyLocalShape,
|
||||
};
|
||||
use crate::mir::builder::control_flow::plan::planner;
|
||||
use crate::mir::builder::control_flow::plan::DomainPlan;
|
||||
use crate::mir::builder::control_flow::plan::{DomainPlan, Pattern2PromotionHint};
|
||||
|
||||
pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<DomainPlan>, String> {
|
||||
use crate::mir::builder::control_flow::joinir::trace;
|
||||
@ -88,7 +91,50 @@ pub(super) fn try_build_domain_plan(ctx: &LoopPatternContext) -> Result<Option<D
|
||||
}
|
||||
};
|
||||
|
||||
let promotion_tag = if matches!(entry.kind, RuleKind::Pattern2)
|
||||
&& crate::config::env::joinir_dev::strict_enabled()
|
||||
{
|
||||
let from_plan = match plan_opt.as_ref() {
|
||||
Some(DomainPlan::Pattern2Break(plan)) => {
|
||||
if let Some(Pattern2PromotionHint::LoopBodyLocal(facts)) = &plan.promotion {
|
||||
Some(match facts.shape {
|
||||
LoopBodyLocalShape::TrimSeg { .. } => {
|
||||
"[plan/pattern2/promotion_hint:TrimSeg]"
|
||||
}
|
||||
LoopBodyLocalShape::DigitPos { .. } => {
|
||||
"[plan/pattern2/promotion_hint:DigitPos]"
|
||||
}
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
from_plan.or_else(|| {
|
||||
try_extract_pattern2_loopbodylocal_facts(ctx.condition, ctx.body)
|
||||
.ok()
|
||||
.and_then(|facts| {
|
||||
facts.map(|facts| match facts.shape {
|
||||
LoopBodyLocalShape::TrimSeg { .. } => {
|
||||
"[plan/pattern2/promotion_hint:TrimSeg]"
|
||||
}
|
||||
LoopBodyLocalShape::DigitPos { .. } => {
|
||||
"[plan/pattern2/promotion_hint:DigitPos]"
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
if let Some(tag) = promotion_tag {
|
||||
eprintln!("{}", tag);
|
||||
}
|
||||
|
||||
if let Some(domain_plan) = plan_opt {
|
||||
|
||||
// Phase 286 P3: Pattern8 static box filtering
|
||||
// Plan extractors are pure (no builder access), so we filter here.
|
||||
if entry.name.contains("Pattern8") && ctx.in_static_box {
|
||||
|
||||
Reference in New Issue
Block a user