diff --git a/crates/difftest/src/own_builder.rs b/crates/difftest/src/own_builder.rs index 6e17ba8747..c93729f7bd 100644 --- a/crates/difftest/src/own_builder.rs +++ b/crates/difftest/src/own_builder.rs @@ -1616,7 +1616,9 @@ pub(crate) fn counts(b: &Brep) -> [usize; 10] { pub(crate) fn build_status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => f64::from(solidcore::error::SM_ERR_INVALID_INPUT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => { + f64::from(solidcore::error::SM_ERR_INVALID_INPUT) + } _ => f64::from(solidcore::error::SM_ERR), } } diff --git a/crates/difftest/src/ssi/engine.rs b/crates/difftest/src/ssi/engine.rs index 20f61eab02..c37e87d883 100644 --- a/crates/difftest/src/ssi/engine.rs +++ b/crates/difftest/src/ssi/engine.rs @@ -241,7 +241,7 @@ fn decode( fn rust_status(e: &SolidError) -> (i64, Option) { match e { SolidError::Upstream { code, .. } => (i64::from(*code), None), - SolidError::InvalidInput { .. } => ( + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => ( SM_ERR_INVALID_INPUT, Some(format!("SM_ERR_INVALID_INPUT ({e})")), ), diff --git a/crates/difftest/src/step.rs b/crates/difftest/src/step.rs index 2ec2f59c77..394507c6dc 100644 --- a/crates/difftest/src/step.rs +++ b/crates/difftest/src/step.rs @@ -158,7 +158,7 @@ fn status(r: &Result, notes: &mut Vec) -> Result Ok(f64::from(*code)), - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { Ok(f64::from(solidcore::error::SM_ERR_INVALID_INPUT)) } Err(e) => { diff --git a/crates/difftest/src/units/blend_fillet_corner_p1.rs b/crates/difftest/src/units/blend_fillet_corner_p1.rs index 6854b3f1c7..08a6f27c7b 100644 --- a/crates/difftest/src/units/blend_fillet_corner_p1.rs +++ b/crates/difftest/src/units/blend_fillet_corner_p1.rs @@ -391,7 +391,7 @@ fn v3(a: [f64; 3]) -> Vec3 { fn status_of(e: &SolidError) -> Option { match e { SolidError::Upstream { code, .. } => Some(f64::from(*code)), - SolidError::InvalidInput { reason, .. } if *reason != NULL_DEREF => Some(1007.0), + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason != NULL_DEREF => Some(1007.0), _ => None, } } @@ -402,7 +402,7 @@ pub(super) fn rust_err(e: &SolidError) -> Output { if let Some(o) = Output::unported(e) { return o; } - if matches!(e, SolidError::InvalidInput { reason, .. } if *reason == NULL_DEREF) { + if matches!(e, SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == NULL_DEREF) { return Output::err("refused"); } match status_of(e) { @@ -930,7 +930,7 @@ fn run_rust(i: &Inputs) -> Result { match corner::check_nx1_degeneracy(&k, &mut t.brep, v, e) { Ok(f) => Ok(vec![flag(f)]), Err(e) if e.is_unported() => Err(e), - Err(e) if matches!(&e, SolidError::InvalidInput { reason, .. } if *reason == NULL_DEREF) => { + Err(e) if matches!(&e, SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == NULL_DEREF) => { Err(e) } Err(e) => Ok(vec![model_status(&e)]), @@ -1898,7 +1898,7 @@ fn corner_err(e: &SolidError) -> Result> { if let Some(o) = Output::unported(e) { return Err(Box::new(o)); } - if matches!(e, SolidError::InvalidInput { reason, .. } if *reason == NULL_DEREF) { + if matches!(e, SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == NULL_DEREF) { return Err(Box::new(Output::err("refused"))); } Ok(model_status(e)) diff --git a/crates/difftest/src/units/blend_fillet_corner_p2.rs b/crates/difftest/src/units/blend_fillet_corner_p2.rs index 20885d3c88..e0b51a9475 100644 --- a/crates/difftest/src/units/blend_fillet_corner_p2.rs +++ b/crates/difftest/src/units/blend_fillet_corner_p2.rs @@ -539,7 +539,7 @@ fn run_rust(i: &Inputs) -> Result { // every InvalidInput of the op is a null dereference upstream (the empty list is // screened above): a missing radial (`NULL_DEREF`) or, from unit // `topology.edgeuse_p1`, a missing edge; the shim refuses both - Err(SolidError::InvalidInput { .. }) => Ok(Output::err("refused")), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(Output::err("refused")), Err(e) => Ok(rust_err(&e)), } } diff --git a/crates/difftest/src/units/blend_fillet_custom_solver.rs b/crates/difftest/src/units/blend_fillet_custom_solver.rs index 61f1454488..1447606e37 100644 --- a/crates/difftest/src/units/blend_fillet_custom_solver.rs +++ b/crates/difftest/src/units/blend_fillet_custom_solver.rs @@ -459,7 +459,7 @@ fn surface_of(s: &InlineSrf) -> Result { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_executive_p3.rs b/crates/difftest/src/units/blend_fillet_executive_p3.rs index 1ff1c1854d..fd1362faca 100644 --- a/crates/difftest/src/units/blend_fillet_executive_p3.rs +++ b/crates/difftest/src/units/blend_fillet_executive_p3.rs @@ -853,7 +853,7 @@ fn rust(input: &Inputs) -> Result { return Ok(deferred); } match error { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => code, other => return Err(HarnessError::new(other.to_string())), } diff --git a/crates/difftest/src/units/blend_fillet_executive_p3/end_to_end.rs b/crates/difftest/src/units/blend_fillet_executive_p3/end_to_end.rs index c849a60afc..2ae48b06b2 100644 --- a/crates/difftest/src/units/blend_fillet_executive_p3/end_to_end.rs +++ b/crates/difftest/src/units/blend_fillet_executive_p3/end_to_end.rs @@ -643,7 +643,7 @@ fn point(out: &mut Vec, p: Vec3) { } pub(super) fn status(error: SolidError) -> SolidResult { match error { - SolidError::InvalidInput { .. } => Ok(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(1007.0), SolidError::Upstream { code, .. } => Ok(f64::from(code)), error => Err(error), } @@ -892,7 +892,7 @@ fn setback_fillet_edges( } // SmApiSetBevelCorners ignores the ordinary StitchAndOrient return status. match stitch_and_orient(k, body, &StitchAndOrientOptions::default()) { - Ok(()) | Err(SolidError::Upstream { .. } | SolidError::InvalidInput { .. }) => Ok(()), + Ok(()) | Err(SolidError::Upstream { .. } | SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(()), Err(error) => Err(error.into()), } } @@ -987,7 +987,7 @@ fn law_fillet_edges( session.do_fillet(k)?; } match stitch_and_orient(k, body, &StitchAndOrientOptions::default()) { - Ok(()) | Err(SolidError::Upstream { .. } | SolidError::InvalidInput { .. }) => Ok(()), + Ok(()) | Err(SolidError::Upstream { .. } | SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(()), Err(error) => Err(error), } } diff --git a/crates/difftest/src/units/blend_fillet_geom_p1.rs b/crates/difftest/src/units/blend_fillet_geom_p1.rs index 49df84afc7..7e450067d5 100644 --- a/crates/difftest/src/units/blend_fillet_geom_p1.rs +++ b/crates/difftest/src/units/blend_fillet_geom_p1.rs @@ -1181,7 +1181,7 @@ fn uv(p: [f64; 2]) -> Point2 { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. pub(crate) fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_geom_p3.rs b/crates/difftest/src/units/blend_fillet_geom_p3.rs index 6c397f7d59..ea75d54adc 100644 --- a/crates/difftest/src/units/blend_fillet_geom_p3.rs +++ b/crates/difftest/src/units/blend_fillet_geom_p3.rs @@ -971,7 +971,7 @@ fn dump_curve(o: &mut Vec, c: Option<&Curve>) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_geom_p6.rs b/crates/difftest/src/units/blend_fillet_geom_p6.rs index 55d0791d93..97c0057297 100644 --- a/crates/difftest/src/units/blend_fillet_geom_p6.rs +++ b/crates/difftest/src/units/blend_fillet_geom_p6.rs @@ -1410,7 +1410,7 @@ fn dump_surface(o: &mut Vec, s: Option<&Surface>) -> Result<(), HarnessErro /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_intersector.rs b/crates/difftest/src/units/blend_fillet_intersector.rs index d0cc86eb05..f1eac7fbd1 100644 --- a/crates/difftest/src/units/blend_fillet_intersector.rs +++ b/crates/difftest/src/units/blend_fillet_intersector.rs @@ -357,7 +357,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_solver_p1.rs b/crates/difftest/src/units/blend_fillet_solver_p1.rs index ad19b453dc..575951d793 100644 --- a/crates/difftest/src/units/blend_fillet_solver_p1.rs +++ b/crates/difftest/src/units/blend_fillet_solver_p1.rs @@ -656,7 +656,7 @@ fn cpp(i: &Inputs) -> Result { fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } @@ -959,7 +959,7 @@ fn rust_brep( put_crv(&k, o, copy.as_ref().or(edge_curve)); Ok(()) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { o.push(-2.0); Ok(()) } @@ -1031,7 +1031,7 @@ fn rust_brep( let side = EdgeuseId::from_index(eid(r[3])?); let one = |res: Result| match res { Ok(v) => Ok(v as f64), - Err(SolidError::InvalidInput { .. }) => Ok(-2.0), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(-2.0), Err(e) => Err(e), }; (|| -> Result<(), SolidError> { @@ -1051,7 +1051,7 @@ fn rust_brep( o.extend([b(tangent), b(opposite)]); Ok(()) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { o.push(-2.0); Ok(()) } diff --git a/crates/difftest/src/units/blend_fillet_solver_p2.rs b/crates/difftest/src/units/blend_fillet_solver_p2.rs index b20daa38bf..9a221c35ea 100644 --- a/crates/difftest/src/units/blend_fillet_solver_p2.rs +++ b/crates/difftest/src/units/blend_fillet_solver_p2.rs @@ -464,7 +464,7 @@ fn cpp(i: &Inputs) -> Result { fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_solver_p3.rs b/crates/difftest/src/units/blend_fillet_solver_p3.rs index b671100182..d665befcf6 100644 --- a/crates/difftest/src/units/blend_fillet_solver_p3.rs +++ b/crates/difftest/src/units/blend_fillet_solver_p3.rs @@ -275,7 +275,7 @@ impl FilletSolverOps for HarnessSolver { fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_fillet_solver_p4.rs b/crates/difftest/src/units/blend_fillet_solver_p4.rs index cef72d02e7..f7b0fa04c9 100644 --- a/crates/difftest/src/units/blend_fillet_solver_p4.rs +++ b/crates/difftest/src/units/blend_fillet_solver_p4.rs @@ -368,7 +368,7 @@ fn setup(r: solidcore::Result, what: &str) -> Result { /// cannot return. fn status(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } diff --git a/crates/difftest/src/units/blend_fillet_standard_solver_p2.rs b/crates/difftest/src/units/blend_fillet_standard_solver_p2.rs index c60594ecdd..8cff342a55 100644 --- a/crates/difftest/src/units/blend_fillet_standard_solver_p2.rs +++ b/crates/difftest/src/units/blend_fillet_standard_solver_p2.rs @@ -735,7 +735,7 @@ fn rust_edgeuse(i: &Inputs) -> Result { return Ok(o); } match e { - SolidError::InvalidInput { .. } => Ok(Output::err("null_deref")), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(Output::err("null_deref")), e => Err(harness(format!("rust: {e}"))), } } @@ -1041,7 +1041,7 @@ fn surface_of(s: &SrfIn) -> Result { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/blend_hcr.rs b/crates/difftest/src/units/blend_hcr.rs index 7859c7600c..1f4d357e00 100644 --- a/crates/difftest/src/units/blend_hcr.rs +++ b/crates/difftest/src/units/blend_hcr.rs @@ -659,7 +659,7 @@ fn run_rust(k: &Kernel, mut h: Hcr, r: &Resolved) -> Result<(f64, Vec), Sol }; match res { Ok(()) => {} - Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => return Err(e), + Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => return Err(e), Err(SolidError::Upstream { code, .. }) => status = f64::from(code), Err(e) => return Err(e), } diff --git a/crates/difftest/src/units/boolean_api_brep.rs b/crates/difftest/src/units/boolean_api_brep.rs index f507371708..b68a02927a 100644 --- a/crates/difftest/src/units/boolean_api_brep.rs +++ b/crates/difftest/src/units/boolean_api_brep.rs @@ -422,7 +422,7 @@ fn ub_242(i: &Inputs) -> Result { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } @@ -759,7 +759,7 @@ fn rust_call_with(k: &mut Kernel, i: &Inputs, seen: &dyn Fn(&SolidError)) -> Res Ok(record(0, o)) } // Rejected: no result (`cleared`) and the list untouched. - Err(e) if matches!(e, SolidError::InvalidInput { .. }) => { + Err(e) if matches!(e, SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { seen(&e); Ok(record(status(&e), vec![1, count(v.len())?])) } diff --git a/crates/difftest/src/units/boolean_merge_p2.rs b/crates/difftest/src/units/boolean_merge_p2.rs index 8ae5dd363f..130b098c3b 100644 --- a/crates/difftest/src/units/boolean_merge_p2.rs +++ b/crates/difftest/src/units/boolean_merge_p2.rs @@ -258,7 +258,7 @@ fn output(raw: &[f64]) -> Result { fn status(e: &SolidError) -> i64 { match e { SolidError::Upstream { code, .. } => i64::from(*code), - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, _ => -1, } } diff --git a/crates/difftest/src/units/boolean_merge_p3.rs b/crates/difftest/src/units/boolean_merge_p3.rs index 74d2e481fe..3c0fd44574 100644 --- a/crates/difftest/src/units/boolean_merge_p3.rs +++ b/crates/difftest/src/units/boolean_merge_p3.rs @@ -240,7 +240,7 @@ fn options(mask: u8) -> MergeOptions { } fn status(error: &SolidError) -> i64 { match error { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } diff --git a/crates/difftest/src/units/boolean_topology_intersector_p1.rs b/crates/difftest/src/units/boolean_topology_intersector_p1.rs index 089b08ca30..f351e92a90 100644 --- a/crates/difftest/src/units/boolean_topology_intersector_p1.rs +++ b/crates/difftest/src/units/boolean_topology_intersector_p1.rs @@ -3579,7 +3579,7 @@ fn status(r: Result, o: &mut Vec) -> Result, Fa o.push(f64::from(code)); Ok(None) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { o.push(NULL_DEREF); Ok(None) } @@ -3868,7 +3868,7 @@ fn run_rust_script(i: &Inputs, p: Prepared) -> Result<(Vec, Vec), Fa } match ti::find_first_lowest_dimension_sol(&sols) { Ok(idx) => o.push(idx as f64), - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => return Err(e.into()), } } @@ -4294,7 +4294,7 @@ fn run_part2_op( // (without the maps, a definition with both finals is the port's // InvalidInput, which the shim refuses with -2 alone) let r = ti.set_relationships(k, two); - if matches!(r, Err(SolidError::InvalidInput { .. })) { + if matches!(r, Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) { o.push(NULL_DEREF); return Ok(()); } diff --git a/crates/difftest/src/units/boolean_topology_intersector_p3.rs b/crates/difftest/src/units/boolean_topology_intersector_p3.rs index 3f7d12c5d6..2c82d084a5 100644 --- a/crates/difftest/src/units/boolean_topology_intersector_p3.rs +++ b/crates/difftest/src/units/boolean_topology_intersector_p3.rs @@ -510,7 +510,7 @@ fn status(r: Result, o: &mut Vec) -> Result, So o.push(f64::from(code)); Ok(None) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { o.push(NULL_DEREF); Ok(None) } diff --git a/crates/difftest/src/units/curve_composite_curve_p1.rs b/crates/difftest/src/units/curve_composite_curve_p1.rs index 336adbe940..19959f4ad4 100644 --- a/crates/difftest/src/units/curve_composite_curve_p1.rs +++ b/crates/difftest/src/units/curve_composite_curve_p1.rs @@ -559,7 +559,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_composite_curve_p2.rs b/crates/difftest/src/units/curve_composite_curve_p2.rs index 0c24504811..6b627971fe 100644 --- a/crates/difftest/src/units/curve_composite_curve_p2.rs +++ b/crates/difftest/src/units/curve_composite_curve_p2.rs @@ -636,7 +636,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_conic.rs b/crates/difftest/src/units/curve_conic.rs index 050f6207a8..8bcee2b1fd 100644 --- a/crates/difftest/src/units/curve_conic.rs +++ b/crates/difftest/src/units/curve_conic.rs @@ -103,7 +103,7 @@ fn lookup(name: &str) -> Result<(Op, bool), HarnessError> { fn status_code(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => i64::from(SM_ERR_INVALID_INPUT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => i64::from(SM_ERR_INVALID_INPUT), SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } diff --git a/crates/difftest/src/units/curve_crv_in_volume.rs b/crates/difftest/src/units/curve_crv_in_volume.rs index e96a239556..3ae88e1370 100644 --- a/crates/difftest/src/units/curve_crv_in_volume.rs +++ b/crates/difftest/src/units/curve_crv_in_volume.rs @@ -571,7 +571,7 @@ fn put_state(o: &mut Vec, c: &CrvInVolume) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_crv_on_surf.rs b/crates/difftest/src/units/curve_crv_on_surf.rs index ddf31924cc..7e68996e7d 100644 --- a/crates/difftest/src/units/curve_crv_on_surf.rs +++ b/crates/difftest/src/units/curve_crv_on_surf.rs @@ -674,7 +674,7 @@ fn put_state(o: &mut Vec, c: &CrvOnSurf) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_cache.rs b/crates/difftest/src/units/curve_curve_cache.rs index ee58053ad8..bb1e5015f9 100644 --- a/crates/difftest/src/units/curve_curve_cache.rs +++ b/crates/difftest/src/units/curve_curve_cache.rs @@ -262,7 +262,7 @@ fn build(c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p1.rs b/crates/difftest/src/units/curve_curve_p1.rs index 5c6da9ae75..5c5288044d 100644 --- a/crates/difftest/src/units/curve_curve_p1.rs +++ b/crates/difftest/src/units/curve_curve_p1.rs @@ -307,7 +307,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p2.rs b/crates/difftest/src/units/curve_curve_p2.rs index 792ffb2bc3..3be3156cb3 100644 --- a/crates/difftest/src/units/curve_curve_p2.rs +++ b/crates/difftest/src/units/curve_curve_p2.rs @@ -750,7 +750,7 @@ fn state(o: &mut Vec, c: &Curve) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p3.rs b/crates/difftest/src/units/curve_curve_p3.rs index 1bb0d47fee..9747ae96b5 100644 --- a/crates/difftest/src/units/curve_curve_p3.rs +++ b/crates/difftest/src/units/curve_curve_p3.rs @@ -508,7 +508,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p4.rs b/crates/difftest/src/units/curve_curve_p4.rs index 17a5bfcf3e..0a66b6009f 100644 --- a/crates/difftest/src/units/curve_curve_p4.rs +++ b/crates/difftest/src/units/curve_curve_p4.rs @@ -609,7 +609,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p5.rs b/crates/difftest/src/units/curve_curve_p5.rs index 6af742f547..b75b796477 100644 --- a/crates/difftest/src/units/curve_curve_p5.rs +++ b/crates/difftest/src/units/curve_curve_p5.rs @@ -619,7 +619,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p6.rs b/crates/difftest/src/units/curve_curve_p6.rs index 6f04abceba..863d76b9ca 100644 --- a/crates/difftest/src/units/curve_curve_p6.rs +++ b/crates/difftest/src/units/curve_curve_p6.rs @@ -481,7 +481,7 @@ fn pv(o: &mut Vec, v: Vec3) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p7.rs b/crates/difftest/src/units/curve_curve_p7.rs index d0dcececff..4472627f4e 100644 --- a/crates/difftest/src/units/curve_curve_p7.rs +++ b/crates/difftest/src/units/curve_curve_p7.rs @@ -434,7 +434,7 @@ fn build(c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p8.rs b/crates/difftest/src/units/curve_curve_p8.rs index d793c2746b..d8420f1a25 100644 --- a/crates/difftest/src/units/curve_curve_p8.rs +++ b/crates/difftest/src/units/curve_curve_p8.rs @@ -294,7 +294,7 @@ fn build(c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_curve_p9.rs b/crates/difftest/src/units/curve_curve_p9.rs index ed51c6ef45..826aaca016 100644 --- a/crates/difftest/src/units/curve_curve_p9.rs +++ b/crates/difftest/src/units/curve_curve_p9.rs @@ -297,7 +297,7 @@ fn build(c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_ellipse_p1.rs b/crates/difftest/src/units/curve_ellipse_p1.rs index 7078bb2d77..b04964c3a0 100644 --- a/crates/difftest/src/units/curve_ellipse_p1.rs +++ b/crates/difftest/src/units/curve_ellipse_p1.rs @@ -494,7 +494,7 @@ fn b(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } @@ -1114,7 +1114,7 @@ fn reads_uninitialised(i: &Inputs) -> bool { for op in &i.ops { if let OpJ::Assert { given } = op { let mut list = AssertArray::new(); - if let Err(SolidError::InvalidInput { reason, .. }) = + if let Err(SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. }) = a.assert_valid(&k, Some(&mut list), *given, KEY_A, KEY_POLAR) { if reason.contains("uninitialised") { diff --git a/crates/difftest/src/units/curve_ellipse_p2.rs b/crates/difftest/src/units/curve_ellipse_p2.rs index e4d2c86f03..c50b80f341 100644 --- a/crates/difftest/src/units/curve_ellipse_p2.rs +++ b/crates/difftest/src/units/curve_ellipse_p2.rs @@ -314,7 +314,7 @@ fn b(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_hermite_curve.rs b/crates/difftest/src/units/curve_hermite_curve.rs index e3a4670200..a875fce3de 100644 --- a/crates/difftest/src/units/curve_hermite_curve.rs +++ b/crates/difftest/src/units/curve_hermite_curve.rs @@ -144,7 +144,7 @@ fn lookup(table: &[(&str, T)], name: &str) -> Result { fn status_code(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => f64::from(SM_ERR_INVALID_INPUT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => f64::from(SM_ERR_INVALID_INPUT), SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_hyperbola.rs b/crates/difftest/src/units/curve_hyperbola.rs index b67d157a87..e68278ce50 100644 --- a/crates/difftest/src/units/curve_hyperbola.rs +++ b/crates/difftest/src/units/curve_hyperbola.rs @@ -255,7 +255,7 @@ fn pv(o: &mut Vec, v: Vec3) { fn status_code(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_iso_curve.rs b/crates/difftest/src/units/curve_iso_curve.rs index fdd042d8dd..57085e5454 100644 --- a/crates/difftest/src/units/curve_iso_curve.rs +++ b/crates/difftest/src/units/curve_iso_curve.rs @@ -427,7 +427,7 @@ fn state(o: &mut Vec, c: &Curve) -> Result<(), HarnessError> { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_line.rs b/crates/difftest/src/units/curve_line.rs index 23db91a501..ec1da21cda 100644 --- a/crates/difftest/src/units/curve_line.rs +++ b/crates/difftest/src/units/curve_line.rs @@ -591,7 +591,7 @@ fn b(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_offset_curve.rs b/crates/difftest/src/units/curve_offset_curve.rs index 560ae4f8c2..f5b13c6ce4 100644 --- a/crates/difftest/src/units/curve_offset_curve.rs +++ b/crates/difftest/src/units/curve_offset_curve.rs @@ -472,7 +472,7 @@ fn clone_ctor_unsafe(i: &Inputs) -> bool { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_parabola.rs b/crates/difftest/src/units/curve_parabola.rs index 90224985fd..24d93efe27 100644 --- a/crates/difftest/src/units/curve_parabola.rs +++ b/crates/difftest/src/units/curve_parabola.rs @@ -125,7 +125,7 @@ fn harness(msg: &str) -> HarnessError { fn status_code(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_projected_curve.rs b/crates/difftest/src/units/curve_projected_curve.rs index 965b30b5e5..e028992b03 100644 --- a/crates/difftest/src/units/curve_projected_curve.rs +++ b/crates/difftest/src/units/curve_projected_curve.rs @@ -638,7 +638,7 @@ fn state(o: &mut Vec, c: &ProjectedCurve) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/curve_tangent_field.rs b/crates/difftest/src/units/curve_tangent_field.rs index 86b6d98a09..12fab87952 100644 --- a/crates/difftest/src/units/curve_tangent_field.rs +++ b/crates/difftest/src/units/curve_tangent_field.rs @@ -503,7 +503,7 @@ fn domain(d: Option<[f64; 4]>) -> Result, HarnessError> { /// cannot return. fn status(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } diff --git a/crates/difftest/src/units/geom_assert_array.rs b/crates/difftest/src/units/geom_assert_array.rs index 2ec9867c0e..33736bf31f 100644 --- a/crates/difftest/src/units/geom_assert_array.rs +++ b/crates/difftest/src/units/geom_assert_array.rs @@ -134,7 +134,7 @@ fn key_int(k: Option) -> i64 { fn normalise(e: &SolidError) -> String { match e { - SolidError::InvalidInput { .. } => "invalid_input".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "invalid_input".into(), SolidError::Upstream { code, .. } => format!("status_{code}"), other => format!("rust_error: {other}"), } diff --git a/crates/difftest/src/units/geom_axis2_placement.rs b/crates/difftest/src/units/geom_axis2_placement.rs index da4033708c..df4a2e6234 100644 --- a/crates/difftest/src/units/geom_axis2_placement.rs +++ b/crates/difftest/src/units/geom_axis2_placement.rs @@ -114,7 +114,7 @@ fn lookup(table: &[(&str, T)], name: &str) -> Result { fn status_code(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => f64::from(SM_ERR_INVALID_INPUT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => f64::from(SM_ERR_INVALID_INPUT), SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/geom_extent1d.rs b/crates/difftest/src/units/geom_extent1d.rs index f06253265b..4f23fa3b2c 100644 --- a/crates/difftest/src/units/geom_extent1d.rs +++ b/crates/difftest/src/units/geom_extent1d.rs @@ -127,7 +127,7 @@ fn e2(e: &Extent1d) -> E2 { /// Status value of a Rust error (upstream `SmStatus`). fn status_of(e: &SolidError) -> Result { match e { - SolidError::InvalidInput { .. } => Ok(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(1007.0), SolidError::Upstream { code, .. } => Ok(f64::from(*code)), other => Err(harness(format!("unexpected rust error: {other}"))), } diff --git a/crates/difftest/src/units/geom_extent2d.rs b/crates/difftest/src/units/geom_extent2d.rs index 599d0ca16c..cda432dccb 100644 --- a/crates/difftest/src/units/geom_extent2d.rs +++ b/crates/difftest/src/units/geom_extent2d.rs @@ -293,7 +293,7 @@ fn b(v: bool) -> f64 { /// Status value of a Rust error (upstream `SmStatus`). fn status_of(e: &SolidError) -> Result { match e { - SolidError::InvalidInput { .. } => Ok(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(1007.0), SolidError::Upstream { code, .. } => Ok(f64::from(*code)), other => Err(harness(format!("unexpected rust error: {other}"))), } diff --git a/crates/difftest/src/units/geom_extent3d.rs b/crates/difftest/src/units/geom_extent3d.rs index e274d20db0..fc74da0784 100644 --- a/crates/difftest/src/units/geom_extent3d.rs +++ b/crates/difftest/src/units/geom_extent3d.rs @@ -287,7 +287,7 @@ fn b(v: bool) -> f64 { /// Status value of a Rust error (upstream `SmStatus`). fn status_of(e: &SolidError) -> Result { match e { - SolidError::InvalidInput { .. } => Ok(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(1007.0), SolidError::Upstream { code, .. } => Ok(f64::from(*code)), other => Err(harness(format!("unexpected rust error: {other}"))), } diff --git a/crates/difftest/src/units/geom_geom_utility_p1.rs b/crates/difftest/src/units/geom_geom_utility_p1.rs index ad8e0f8936..72cb04e0e4 100644 --- a/crates/difftest/src/units/geom_geom_utility_p1.rs +++ b/crates/difftest/src/units/geom_geom_utility_p1.rs @@ -116,7 +116,7 @@ fn lookup(name: &str) -> Result { /// Upstream status of a Rust error, or `None` for errors with no upstream status. fn status_code(e: &SolidError) -> Option { match e { - SolidError::InvalidInput { .. } => Some(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Some(1007.0), SolidError::Upstream { code, .. } => Some(f64::from(*code)), _ => None, } diff --git a/crates/difftest/src/units/geom_geom_utility_p2.rs b/crates/difftest/src/units/geom_geom_utility_p2.rs index 79c86fe643..f312de713b 100644 --- a/crates/difftest/src/units/geom_geom_utility_p2.rs +++ b/crates/difftest/src/units/geom_geom_utility_p2.rs @@ -75,7 +75,7 @@ fn status(code: i32) -> Output { fn normalise(e: &SolidError) -> String { match e { - SolidError::InvalidInput { .. } => "status_1007".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "status_1007".into(), SolidError::Upstream { code, .. } => format!("status_{code}"), other => format!("rust_error: {other}"), } diff --git a/crates/difftest/src/units/geom_grid/tests.rs b/crates/difftest/src/units/geom_grid/tests.rs index 090b52b466..57eb2e9cd0 100644 --- a/crates/difftest/src/units/geom_grid/tests.rs +++ b/crates/difftest/src/units/geom_grid/tests.rs @@ -111,7 +111,7 @@ fn explicit_definition_does_not_resolve_an_opaque_label() { ]; assert!(matches!( run_rust(&i, &mut Stats::default()), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) )); } diff --git a/crates/difftest/src/units/geom_local_solve_nd.rs b/crates/difftest/src/units/geom_local_solve_nd.rs index 71786c85ff..fb14c03091 100644 --- a/crates/difftest/src/units/geom_local_solve_nd.rs +++ b/crates/difftest/src/units/geom_local_solve_nd.rs @@ -599,7 +599,7 @@ fn rust(p: &Parsed) -> Result { Err(e) => Ok(Output::unported(&e).unwrap_or_else(|| { Output::err(match e { SolidError::Upstream { code, .. } => format!("status_{code}"), - SolidError::InvalidInput { .. } => "status_1007".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "status_1007".into(), other => format!("rust_error: {other}"), }) })), diff --git a/crates/difftest/src/units/geom_matrix.rs b/crates/difftest/src/units/geom_matrix.rs index e4555d46b8..fdb12ff614 100644 --- a/crates/difftest/src/units/geom_matrix.rs +++ b/crates/difftest/src/units/geom_matrix.rs @@ -91,7 +91,7 @@ fn floats(v: &[Value]) -> Result, HarnessError> { fn normalise(e: &SolidError) -> String { match e { - SolidError::InvalidInput { .. } => "status_1007".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "status_1007".into(), SolidError::Upstream { code, .. } => format!("status_{code}"), other => format!("rust_error: {other}"), } diff --git a/crates/difftest/src/units/geom_periodic_extent1d.rs b/crates/difftest/src/units/geom_periodic_extent1d.rs index 38895ccac1..574635cc0a 100644 --- a/crates/difftest/src/units/geom_periodic_extent1d.rs +++ b/crates/difftest/src/units/geom_periodic_extent1d.rs @@ -123,7 +123,7 @@ fn status_of(r: &solidcore::Result<()>) -> Result { match r { Ok(()) => Ok(SM_SUCCESS), Err(SolidError::Upstream { code, .. }) => Ok(i64::from(*code)), - Err(SolidError::InvalidInput { .. }) => Ok(SM_ERR_INVALID_INPUT), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(SM_ERR_INVALID_INPUT), Err(e) => Err(HarnessError::new(format!("rust_error: {e}"))), } } diff --git a/crates/difftest/src/units/geom_transform.rs b/crates/difftest/src/units/geom_transform.rs index bb26f2107e..150b9c5800 100644 --- a/crates/difftest/src/units/geom_transform.rs +++ b/crates/difftest/src/units/geom_transform.rs @@ -139,7 +139,7 @@ fn lookup(table: &[(&str, T)], name: &str) -> Result { fn status_code(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => f64::from(SM_ERR_INVALID_INPUT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => f64::from(SM_ERR_INVALID_INPUT), SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/geom_tree.rs b/crates/difftest/src/units/geom_tree.rs index 9328757758..b8acdf60b0 100644 --- a/crates/difftest/src/units/geom_tree.rs +++ b/crates/difftest/src/units/geom_tree.rs @@ -291,7 +291,7 @@ fn flag(b: bool) -> i64 { /// Upstream status of a Rust error. fn status_of(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => i64::from(*code), _ => 1001, } diff --git a/crates/difftest/src/units/geom_vector2d.rs b/crates/difftest/src/units/geom_vector2d.rs index 0d56068100..9fde82d045 100644 --- a/crates/difftest/src/units/geom_vector2d.rs +++ b/crates/difftest/src/units/geom_vector2d.rs @@ -88,7 +88,7 @@ fn lookup(name: &str) -> Result { fn normalise(e: &SolidError) -> String { match e { - SolidError::InvalidInput { .. } => "invalid_input".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "invalid_input".into(), SolidError::Upstream { code, .. } => format!("status_{code}"), other => format!("rust_error: {other}"), } diff --git a/crates/difftest/src/units/geom_vector3d.rs b/crates/difftest/src/units/geom_vector3d.rs index 27021e6ffe..c273c307bb 100644 --- a/crates/difftest/src/units/geom_vector3d.rs +++ b/crates/difftest/src/units/geom_vector3d.rs @@ -134,7 +134,7 @@ fn lookup(name: &str) -> Result { fn normalise(e: &SolidError) -> String { match e { - SolidError::InvalidInput { .. } => "invalid_input".into(), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => "invalid_input".into(), SolidError::Upstream { code, .. } => format!("status_{code}"), other => format!("rust_error: {other}"), } diff --git a/crates/difftest/src/units/heal_gap.rs b/crates/difftest/src/units/heal_gap.rs index 96379fde73..8e8383eb51 100644 --- a/crates/difftest/src/units/heal_gap.rs +++ b/crates/difftest/src/units/heal_gap.rs @@ -1174,7 +1174,7 @@ fn run_rust(i: &Inputs) -> Result { let args = topo_args(&b, c, *kind, *sel0, *sel1, *f0, *f1, *uv)?; match topo_rust(&k, &mut b, &args) { Ok(v) => o = v, - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => return rust_fail(&e), } } diff --git a/crates/difftest/src/units/heal_heal_data_p1.rs b/crates/difftest/src/units/heal_heal_data_p1.rs index 0916452b9c..ffc7d9f3e3 100644 --- a/crates/difftest/src/units/heal_heal_data_p1.rs +++ b/crates/difftest/src/units/heal_heal_data_p1.rs @@ -138,7 +138,7 @@ fn run_rust(i: &Inputs) -> Result { create_status = SM_SUCCESS; api_heal_brep(&mut k, Some(&mut b)) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { return Ok(Output::new().values("out", vec![SM_ERR_INVALID_INPUT, 0.0])); } Err(e) => { @@ -150,7 +150,7 @@ fn run_rust(i: &Inputs) -> Result { }; Ok(match r { Ok(()) => Output::new().values("out", vec![create_status, SM_SUCCESS]), - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { Output::new().values("out", vec![create_status, SM_ERR_INVALID_INPUT]) } Err(e) => Output::unported(&e).unwrap_or_else(|| Output::err(e.to_string())), diff --git a/crates/difftest/src/units/heal_heal_data_p2.rs b/crates/difftest/src/units/heal_heal_data_p2.rs index 1c7c687d51..baaaabea33 100644 --- a/crates/difftest/src/units/heal_heal_data_p2.rs +++ b/crates/difftest/src/units/heal_heal_data_p2.rs @@ -824,7 +824,7 @@ fn rust_prob(kind: u8, n: u64, ops: &[[i64; 4]]) -> Result let r = match kind { 1 => match pair.remove(&arena, p) { Ok(r) => r, - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { o.push(NULL_DEREF); stop = true; continue; @@ -966,7 +966,7 @@ fn classify(e: SolidError) -> Fail { return Fail::Deferred(o); } match e { - SolidError::InvalidInput { .. } => Fail::NullDeref, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Fail::NullDeref, SolidError::Upstream { code, .. } => Fail::Status(code), e => Fail::Other(e.to_string()), } diff --git a/crates/difftest/src/units/heal_stitch_p1.rs b/crates/difftest/src/units/heal_stitch_p1.rs index 0582127f1f..c2f6c90bad 100644 --- a/crates/difftest/src/units/heal_stitch_p1.rs +++ b/crates/difftest/src/units/heal_stitch_p1.rs @@ -848,10 +848,10 @@ fn run_cpp(k: &Kernel, i: &Inputs) -> Result { fn status_of(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { operation, .. } if *operation == "heal::stitch::p1" => { + SolidError::InvalidInput { operation, .. } | SolidError::PortInvariant { operation, .. } if *operation == "heal::stitch::p1" => { NULL_DEREF } - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => -9.0, } } diff --git a/crates/difftest/src/units/heal_stitch_p2.rs b/crates/difftest/src/units/heal_stitch_p2.rs index fadae7a851..1834ab3807 100644 --- a/crates/difftest/src/units/heal_stitch_p2.rs +++ b/crates/difftest/src/units/heal_stitch_p2.rs @@ -482,12 +482,12 @@ fn run_cpp(i: &Inputs) -> Result { fn status_of(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { operation, .. } + SolidError::InvalidInput { operation, .. } | SolidError::PortInvariant { operation, .. } if *operation == "heal::stitch::p1" || *operation == "heal::stitch::p2" => { NULL_DEREF } - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => -9.0, } } diff --git a/crates/difftest/src/units/intersect_adv_surface_intersector.rs b/crates/difftest/src/units/intersect_adv_surface_intersector.rs index bc1bdf7a53..ec30c82a44 100644 --- a/crates/difftest/src/units/intersect_adv_surface_intersector.rs +++ b/crates/difftest/src/units/intersect_adv_surface_intersector.rs @@ -321,7 +321,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } @@ -581,7 +581,7 @@ fn branch(a: usize, b: usize) -> [Option; MAX_SOLVER_TREES] { /// True for the error `ComputeSingularityPoint` returns on a ninth singular direction. fn is_sing_overflow(e: &SolidError) -> bool { - matches!(e, SolidError::InvalidInput { reason, .. } if reason.starts_with("more than 8 singular")) + matches!(e, SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if reason.starts_with("more than 8 singular")) } struct Ctx<'a> { diff --git a/crates/difftest/src/units/intersect_curve_class_p1.rs b/crates/difftest/src/units/intersect_curve_class_p1.rs index 42775bfa26..fb82be35f9 100644 --- a/crates/difftest/src/units/intersect_curve_class_p1.rs +++ b/crates/difftest/src/units/intersect_curve_class_p1.rs @@ -1105,7 +1105,7 @@ pub(crate) fn build_pool(objects: &[ObjIn]) -> Result { pub(crate) fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/intersect_curve_class_p3.rs b/crates/difftest/src/units/intersect_curve_class_p3.rs index 102ee4c8d5..44d4c76e01 100644 --- a/crates/difftest/src/units/intersect_curve_class_p3.rs +++ b/crates/difftest/src/units/intersect_curve_class_p3.rs @@ -818,7 +818,7 @@ fn build_pool(objects: &[ObjIn]) -> Result { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/intersect_curve_class_p4.rs b/crates/difftest/src/units/intersect_curve_class_p4.rs index 0ef1a16dfc..4a5ac804df 100644 --- a/crates/difftest/src/units/intersect_curve_class_p4.rs +++ b/crates/difftest/src/units/intersect_curve_class_p4.rs @@ -907,7 +907,7 @@ pub(crate) fn face_brep(k: &Kernel, face: &FaceIn) -> Result<(Brep, FaceId), Har fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/intersect_curve_class_p5.rs b/crates/difftest/src/units/intersect_curve_class_p5.rs index 2f6e89948d..67a398ec7c 100644 --- a/crates/difftest/src/units/intersect_curve_class_p5.rs +++ b/crates/difftest/src/units/intersect_curve_class_p5.rs @@ -323,7 +323,7 @@ fn put_cc(out: &mut Vec, cc: &CurveClassification, target: H) { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007., + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007., _ => -1., } } diff --git a/crates/difftest/src/units/intersect_curve_class_p6.rs b/crates/difftest/src/units/intersect_curve_class_p6.rs index 479f3956bb..dfe7db2c26 100644 --- a/crates/difftest/src/units/intersect_curve_class_p6.rs +++ b/crates/difftest/src/units/intersect_curve_class_p6.rs @@ -414,7 +414,7 @@ fn put_pc(out: &mut Vec, pc: &PointClassification, g: &Geometry) { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/intersect_ray_tracer.rs b/crates/difftest/src/units/intersect_ray_tracer.rs index bb22562ea8..c516602bc2 100644 --- a/crates/difftest/src/units/intersect_ray_tracer.rs +++ b/crates/difftest/src/units/intersect_ray_tracer.rs @@ -457,7 +457,7 @@ fn build_poly( /// The status of a failed Rust operation, as upstream numbers it. fn status_of(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => 1001.0, } diff --git a/crates/difftest/src/units/intersect_surface_drop_curve.rs b/crates/difftest/src/units/intersect_surface_drop_curve.rs index 82349afbde..a2870e9936 100644 --- a/crates/difftest/src/units/intersect_surface_drop_curve.rs +++ b/crates/difftest/src/units/intersect_surface_drop_curve.rs @@ -385,7 +385,7 @@ fn rust_curve(c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_drop_lib_p1.rs b/crates/difftest/src/units/intersect_surface_drop_lib_p1.rs index 2080ed7303..c0866e1641 100644 --- a/crates/difftest/src/units/intersect_surface_drop_lib_p1.rs +++ b/crates/difftest/src/units/intersect_surface_drop_lib_p1.rs @@ -681,7 +681,7 @@ fn put_uv_curve(o: &mut Vec, c: &Curve) -> Option> { /// The `SmStatus` of a Rust error. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => 1001.0, } diff --git a/crates/difftest/src/units/intersect_surface_drop_lib_p2.rs b/crates/difftest/src/units/intersect_surface_drop_lib_p2.rs index e394f94d57..aa031adea7 100644 --- a/crates/difftest/src/units/intersect_surface_drop_lib_p2.rs +++ b/crates/difftest/src/units/intersect_surface_drop_lib_p2.rs @@ -564,7 +564,7 @@ pub(crate) fn put_curve(o: &mut Vec, c: &BSplineCurve) -> solidcore::Result /// The `SmStatus` of a Rust error. pub(crate) fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => 1001.0, } diff --git a/crates/difftest/src/units/intersect_surface_intersector_p1.rs b/crates/difftest/src/units/intersect_surface_intersector_p1.rs index 8ff6a21f24..7a1c163d77 100644 --- a/crates/difftest/src/units/intersect_surface_intersector_p1.rs +++ b/crates/difftest/src/units/intersect_surface_intersector_p1.rs @@ -397,7 +397,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_intersector_p2.rs b/crates/difftest/src/units/intersect_surface_intersector_p2.rs index 2c644e37e2..d61c60340d 100644 --- a/crates/difftest/src/units/intersect_surface_intersector_p2.rs +++ b/crates/difftest/src/units/intersect_surface_intersector_p2.rs @@ -328,7 +328,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_intersector_p3.rs b/crates/difftest/src/units/intersect_surface_intersector_p3.rs index c1cbf8c162..cb1c69db1d 100644 --- a/crates/difftest/src/units/intersect_surface_intersector_p3.rs +++ b/crates/difftest/src/units/intersect_surface_intersector_p3.rs @@ -295,7 +295,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_intersector_p4.rs b/crates/difftest/src/units/intersect_surface_intersector_p4.rs index dd6cd850f3..24b93072ba 100644 --- a/crates/difftest/src/units/intersect_surface_intersector_p4.rs +++ b/crates/difftest/src/units/intersect_surface_intersector_p4.rs @@ -290,7 +290,7 @@ impl From for Fail { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_intersector_p5.rs b/crates/difftest/src/units/intersect_surface_intersector_p5.rs index debff9718c..4b1025c09a 100644 --- a/crates/difftest/src/units/intersect_surface_intersector_p5.rs +++ b/crates/difftest/src/units/intersect_surface_intersector_p5.rs @@ -233,7 +233,7 @@ fn cpp(i: &Inputs) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_silhouette.rs b/crates/difftest/src/units/intersect_surface_silhouette.rs index 827bafc87d..f3163bc0a9 100644 --- a/crates/difftest/src/units/intersect_surface_silhouette.rs +++ b/crates/difftest/src/units/intersect_surface_silhouette.rs @@ -346,7 +346,7 @@ fn rust_curve(d: &CurveData) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_surface_tracer.rs b/crates/difftest/src/units/intersect_surface_tracer.rs index 63a6355613..9d71dbf9d4 100644 --- a/crates/difftest/src/units/intersect_surface_tracer.rs +++ b/crates/difftest/src/units/intersect_surface_tracer.rs @@ -512,7 +512,7 @@ impl<'s> SurfaceTrace<'s> for SectionTracer<'s> { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_topology_solver_p1.rs b/crates/difftest/src/units/intersect_topology_solver_p1.rs index 5b10c5f464..9784d685b5 100644 --- a/crates/difftest/src/units/intersect_topology_solver_p1.rs +++ b/crates/difftest/src/units/intersect_topology_solver_p1.rs @@ -749,7 +749,7 @@ impl TopologyObjects for Scene { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/intersect_topology_solver_p2.rs b/crates/difftest/src/units/intersect_topology_solver_p2.rs index 177fa1c1bd..70021778a2 100644 --- a/crates/difftest/src/units/intersect_topology_solver_p2.rs +++ b/crates/difftest/src/units/intersect_topology_solver_p2.rs @@ -651,7 +651,7 @@ fn static_rust(case: &Case) -> Result { return Ok(deferred); } let status = match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(code), _ => return Err(HarnessError::new(e.to_string())), }; diff --git a/crates/difftest/src/units/mass_integrator.rs b/crates/difftest/src/units/mass_integrator.rs index 9427d729a3..8b45af7916 100644 --- a/crates/difftest/src/units/mass_integrator.rs +++ b/crates/difftest/src/units/mass_integrator.rs @@ -49,7 +49,7 @@ fn output(v: Vec) -> Output { } fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => 1001.0, } diff --git a/crates/difftest/src/units/nlib_crv_adv_p1.rs b/crates/difftest/src/units/nlib_crv_adv_p1.rs index 20c4455648..b9dee0085c 100644 --- a/crates/difftest/src/units/nlib_crv_adv_p1.rs +++ b/crates/difftest/src/units/nlib_crv_adv_p1.rs @@ -433,7 +433,7 @@ fn status(e: &SolidError) -> f64 { { 1000.0 } - SolidError::InvalidInput { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/nlib_crv_adv_p2.rs b/crates/difftest/src/units/nlib_crv_adv_p2.rs index 2dc930fcd2..43acbba196 100644 --- a/crates/difftest/src/units/nlib_crv_adv_p2.rs +++ b/crates/difftest/src/units/nlib_crv_adv_p2.rs @@ -566,7 +566,7 @@ fn status(e: &SolidError) -> f64 { { 1000.0 } - SolidError::InvalidInput { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/nlib_crv_approx.rs b/crates/difftest/src/units/nlib_crv_approx.rs index 1b732a5b2a..d0ea678cc4 100644 --- a/crates/difftest/src/units/nlib_crv_approx.rs +++ b/crates/difftest/src/units/nlib_crv_approx.rs @@ -337,7 +337,7 @@ fn status(e: &SolidError) -> f64 { SolidError::NotConverged { operation, .. } if operation.starts_with("nurbs::bezier") => { 1000.0 } - SolidError::InvalidInput { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/nlib_crv_offset.rs b/crates/difftest/src/units/nlib_crv_offset.rs index 9dcae8ee45..62356c425d 100644 --- a/crates/difftest/src/units/nlib_crv_offset.rs +++ b/crates/difftest/src/units/nlib_crv_offset.rs @@ -213,7 +213,7 @@ fn status(e: &SolidError) -> f64 { SolidError::NotConverged { operation, .. } if operation.starts_with("nurbs::bezier") => { 1000.0 } - SolidError::InvalidInput { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == BARE_FLAG_REASON => 1000.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/nlib_srf_adv_p1.rs b/crates/difftest/src/units/nlib_srf_adv_p1.rs index d15379cbd5..ec13655d11 100644 --- a/crates/difftest/src/units/nlib_srf_adv_p1.rs +++ b/crates/difftest/src/units/nlib_srf_adv_p1.rs @@ -428,7 +428,7 @@ fn status(r: &SolidResult) -> f64 { match r { Ok(_) => 0.0, Err(SolidError::Nlib { code, .. }) => f64::from(code.code()), - Err(SolidError::InvalidInput { reason, .. }) if *reason == BARE_FLAG_REASON => BARE_FLAG, + Err(SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. }) if *reason == BARE_FLAG_REASON => BARE_FLAG, Err(SolidError::NotConverged { operation, .. }) if operation.ends_with("srf_adv::p2::extend_by_dist_at_depth") => { diff --git a/crates/difftest/src/units/nlib_srf_adv_p4.rs b/crates/difftest/src/units/nlib_srf_adv_p4.rs index 12e38bbcc9..0a20f503a5 100644 --- a/crates/difftest/src/units/nlib_srf_adv_p4.rs +++ b/crates/difftest/src/units/nlib_srf_adv_p4.rs @@ -462,7 +462,7 @@ fn status(r: &SolidResult) -> f64 { match r { Ok(_) => 0.0, Err(SolidError::Nlib { code, .. }) => f64::from(code.code()), - Err(SolidError::InvalidInput { reason, .. }) if *reason == BARE_FLAG_REASON => 1000.0, + Err(SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. }) if *reason == BARE_FLAG_REASON => 1000.0, Err(_) => -1.0, } } diff --git a/crates/difftest/src/units/nurbs_b_spline_curve_n_lib.rs b/crates/difftest/src/units/nurbs_b_spline_curve_n_lib.rs index 8e6258285c..8c25b94d58 100644 --- a/crates/difftest/src/units/nurbs_b_spline_curve_n_lib.rs +++ b/crates/difftest/src/units/nurbs_b_spline_curve_n_lib.rs @@ -726,7 +726,7 @@ fn dump_state(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_curve_p1.rs b/crates/difftest/src/units/nurbs_b_spline_curve_p1.rs index 7368cb61bf..8ab465cf49 100644 --- a/crates/difftest/src/units/nurbs_b_spline_curve_p1.rs +++ b/crates/difftest/src/units/nurbs_b_spline_curve_p1.rs @@ -706,7 +706,7 @@ fn dump_state(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_curve_p2.rs b/crates/difftest/src/units/nurbs_b_spline_curve_p2.rs index 3a9271098a..0d62327db6 100644 --- a/crates/difftest/src/units/nurbs_b_spline_curve_p2.rs +++ b/crates/difftest/src/units/nurbs_b_spline_curve_p2.rs @@ -731,7 +731,7 @@ fn dump_state(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_curve_p3.rs b/crates/difftest/src/units/nurbs_b_spline_curve_p3.rs index 5c8f96362f..7ca34a265f 100644 --- a/crates/difftest/src/units/nurbs_b_spline_curve_p3.rs +++ b/crates/difftest/src/units/nurbs_b_spline_curve_p3.rs @@ -510,7 +510,7 @@ fn dump_state(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p1.rs b/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p1.rs index 0e5ba8f5e2..ce4c09ca9d 100644 --- a/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p1.rs +++ b/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p1.rs @@ -840,7 +840,7 @@ fn dump_curve(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p2.rs b/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p2.rs index b3aeed3b35..151e763b94 100644 --- a/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p2.rs +++ b/crates/difftest/src/units/nurbs_b_spline_surface_n_lib_p2.rs @@ -680,7 +680,7 @@ fn dump_state(o: &mut Vec, s: &BSplineSurface) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_surface_p1.rs b/crates/difftest/src/units/nurbs_b_spline_surface_p1.rs index b299028d91..9e3031738e 100644 --- a/crates/difftest/src/units/nurbs_b_spline_surface_p1.rs +++ b/crates/difftest/src/units/nurbs_b_spline_surface_p1.rs @@ -877,7 +877,7 @@ fn push_knots(o: &mut Vec, k: &[f64], m: &[usize]) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_b_spline_surface_p2.rs b/crates/difftest/src/units/nurbs_b_spline_surface_p2.rs index 861feb3982..8e5071e4c2 100644 --- a/crates/difftest/src/units/nurbs_b_spline_surface_p2.rs +++ b/crates/difftest/src/units/nurbs_b_spline_surface_p2.rs @@ -755,7 +755,7 @@ fn dump_curve(o: &mut Vec, c: &BSplineCurve) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/nurbs_nurbs_srf.rs b/crates/difftest/src/units/nurbs_nurbs_srf.rs index e4bc2850e0..538ecbaba0 100644 --- a/crates/difftest/src/units/nurbs_nurbs_srf.rs +++ b/crates/difftest/src/units/nurbs_nurbs_srf.rs @@ -334,7 +334,7 @@ fn status(r: &SolidResult) -> f64 { Err(SolidError::Upstream { code, .. }) => f64::from(*code), // Upstream's NLib flag without an error number (see the module docs of // `solidcore::nurbs::nurbs_srf`). - Err(SolidError::InvalidInput { .. }) => 1000.0, + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => 1000.0, Err(_) => -1.0, } } diff --git a/crates/difftest/src/units/offset_offset_geometry_creation.rs b/crates/difftest/src/units/offset_offset_geometry_creation.rs index d4945cff21..84f348dfd0 100644 --- a/crates/difftest/src/units/offset_offset_geometry_creation.rs +++ b/crates/difftest/src/units/offset_offset_geometry_creation.rs @@ -2588,7 +2588,7 @@ fn status(r: Result, o: &mut Vec) -> Result, Fa o.push(NULL_DEREF); Ok(None) } - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { // upstream's SM_ERR_INVALID_INPUT status of a callee o.push(SM_ERR_INVALID_INPUT); Ok(None) diff --git a/crates/difftest/src/units/primitive_api_curve_ops.rs b/crates/difftest/src/units/primitive_api_curve_ops.rs index dc932ecf5a..285b528d02 100644 --- a/crates/difftest/src/units/primitive_api_curve_ops.rs +++ b/crates/difftest/src/units/primitive_api_curve_ops.rs @@ -210,7 +210,7 @@ fn cpp(i: &In) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/primitive_api_curves.rs b/crates/difftest/src/units/primitive_api_curves.rs index 0a0e036e32..e2d4960cb6 100644 --- a/crates/difftest/src/units/primitive_api_curves.rs +++ b/crates/difftest/src/units/primitive_api_curves.rs @@ -271,7 +271,7 @@ fn b(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/primitive_api_primitives.rs b/crates/difftest/src/units/primitive_api_primitives.rs index dc15161f4c..c59a45e51d 100644 --- a/crates/difftest/src/units/primitive_api_primitives.rs +++ b/crates/difftest/src/units/primitive_api_primitives.rs @@ -235,7 +235,7 @@ fn accepted(i: &Inputs) -> bool { /// The upstream status of a Rust error. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/primitive_primitive_creation_p1.rs b/crates/difftest/src/units/primitive_primitive_creation_p1.rs index 04bb222c52..5132bdf306 100644 --- a/crates/difftest/src/units/primitive_primitive_creation_p1.rs +++ b/crates/difftest/src/units/primitive_primitive_creation_p1.rs @@ -431,7 +431,7 @@ fn rust(i: &Inputs) -> solidcore::Result> { let status = match result { Ok(()) => 0, Err(e) if e.is_unported() => return Err(e), - Err(solidcore::SolidError::InvalidInput { .. }) => 1007, + Err(solidcore::SolidError::InvalidInput { .. } | solidcore::SolidError::PortInvariant { .. }) => 1007, Err(solidcore::SolidError::Upstream { code, .. }) => code, Err(_) => solidcore::error::SM_ERR, }; @@ -465,7 +465,7 @@ fn rust(i: &Inputs) -> solidcore::Result> { let status = match result { Ok(()) => 0, Err(e) if e.is_unported() => return Err(e), - Err(solidcore::SolidError::InvalidInput { .. }) => 1007, + Err(solidcore::SolidError::InvalidInput { .. } | solidcore::SolidError::PortInvariant { .. }) => 1007, Err(solidcore::SolidError::Upstream { code, .. }) => code, Err(_) => solidcore::error::SM_ERR, }; @@ -522,7 +522,7 @@ fn rust(i: &Inputs) -> solidcore::Result> { let status = match result { Ok(()) => 0, Err(e) if e.is_unported() => return Err(e), - Err(solidcore::SolidError::InvalidInput { .. }) => 1007, + Err(solidcore::SolidError::InvalidInput { .. } | solidcore::SolidError::PortInvariant { .. }) => 1007, Err(solidcore::SolidError::Upstream { code, .. }) => code, Err(_) => solidcore::error::SM_ERR, }; diff --git a/crates/difftest/src/units/primitive_primitive_creation_p2.rs b/crates/difftest/src/units/primitive_primitive_creation_p2.rs index 189aaeb84a..4f6adb4c6c 100644 --- a/crates/difftest/src/units/primitive_primitive_creation_p2.rs +++ b/crates/difftest/src/units/primitive_primitive_creation_p2.rs @@ -38,7 +38,7 @@ struct Inputs { fn error(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007., + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007., _ => 1001., } } diff --git a/crates/difftest/src/units/query_api_queries.rs b/crates/difftest/src/units/query_api_queries.rs index 01ccc9876b..ae5239644a 100644 --- a/crates/difftest/src/units/query_api_queries.rs +++ b/crates/difftest/src/units/query_api_queries.rs @@ -64,7 +64,7 @@ fn cclosest(o: &mut Vec, p: api::CurveClosestPoint) { } fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007., + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007., SolidError::Upstream { code, .. } => f64::from(*code), _ => -1., } diff --git a/crates/difftest/src/units/query_edge.rs b/crates/difftest/src/units/query_edge.rs index b112208353..c8b28adb3b 100644 --- a/crates/difftest/src/units/query_edge.rs +++ b/crates/difftest/src/units/query_edge.rs @@ -926,7 +926,7 @@ fn rust_err(e: &SolidError) -> Output { if let Some(o) = Output::unported(e) { return o; } - let failed = if matches!(e, SolidError::InvalidInput { .. }) { + let failed = if matches!(e, SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) { NULL_DEREF } else { 1 diff --git a/crates/difftest/src/units/query_face_p1.rs b/crates/difftest/src/units/query_face_p1.rs index b0451b481d..8155b2673b 100644 --- a/crates/difftest/src/units/query_face_p1.rs +++ b/crates/difftest/src/units/query_face_p1.rs @@ -751,7 +751,7 @@ fn run_curve(k: &Kernel, input: &CurveInput, cpp: bool) -> Result Ok(curve_output(1007, values)), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(curve_output(1007, values)), Err(SolidError::Upstream { code, .. }) => Ok(curve_output(code, values)), Err(e) => Ok(rust_err(&e)), } diff --git a/crates/difftest/src/units/query_face_p3.rs b/crates/difftest/src/units/query_face_p3.rs index c4067dea52..44dc99eb19 100644 --- a/crates/difftest/src/units/query_face_p3.rs +++ b/crates/difftest/src/units/query_face_p3.rs @@ -834,7 +834,7 @@ fn rust_bisector(k: &Kernel, b: &Brep, c: &BisectorCase) -> Result { status_err(SM_ERR_INVALID_INPUT as f64) diff --git a/crates/difftest/src/units/query_face_p4.rs b/crates/difftest/src/units/query_face_p4.rs index 5a50fea012..f5f28e5926 100644 --- a/crates/difftest/src/units/query_face_p4.rs +++ b/crates/difftest/src/units/query_face_p4.rs @@ -1115,7 +1115,7 @@ fn rust(i: &Inputs) -> Result { return Ok(d); } match &e { - SolidError::InvalidInput { reason, .. } + SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. } if *reason == qf4::NOT_THIS_FACE || *reason == qf4::NO_SURFACE => { SM_ERR_INVALID_INPUT diff --git a/crates/difftest/src/units/query_poly_properties.rs b/crates/difftest/src/units/query_poly_properties.rs index 3e0fb6c993..c33fa4f6b3 100644 --- a/crates/difftest/src/units/query_poly_properties.rs +++ b/crates/difftest/src/units/query_poly_properties.rs @@ -71,7 +71,7 @@ fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), // SM_ERR_INVALID_INPUT - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/query_tess.rs b/crates/difftest/src/units/query_tess.rs index fbb6f7ba48..4eabc9a340 100644 --- a/crates/difftest/src/units/query_tess.rs +++ b/crates/difftest/src/units/query_tess.rs @@ -472,7 +472,7 @@ fn link(i: i64) -> Option { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> i64 { match e { - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Upstream { code, .. } => i64::from(*code), _ => -1, } diff --git a/crates/difftest/src/units/surface_b_spline_volume.rs b/crates/difftest/src/units/surface_b_spline_volume.rs index 63a7bc05aa..dac9ab4434 100644 --- a/crates/difftest/src/units/surface_b_spline_volume.rs +++ b/crates/difftest/src/units/surface_b_spline_volume.rs @@ -397,7 +397,7 @@ fn put_knots(o: &mut Vec, r: solidcore::Result<(Vec, Vec)>) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_b_spline_volume_n_lib.rs b/crates/difftest/src/units/surface_b_spline_volume_n_lib.rs index 2e2a10ce27..2f0eb787e3 100644 --- a/crates/difftest/src/units/surface_b_spline_volume_n_lib.rs +++ b/crates/difftest/src/units/surface_b_spline_volume_n_lib.rs @@ -333,7 +333,7 @@ fn build_curve(k: &Kernel, c: &CurveIn) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_bend_volume.rs b/crates/difftest/src/units/surface_bend_volume.rs index 228b9d63ab..35f92f55dc 100644 --- a/crates/difftest/src/units/surface_bend_volume.rs +++ b/crates/difftest/src/units/surface_bend_volume.rs @@ -427,7 +427,7 @@ fn ext(d: &[[f64; 3]; 2]) -> Extent3d { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_cone_p1.rs b/crates/difftest/src/units/surface_cone_p1.rs index 213c149b22..f86dd46256 100644 --- a/crates/difftest/src/units/surface_cone_p1.rs +++ b/crates/difftest/src/units/surface_cone_p1.rs @@ -516,7 +516,7 @@ fn push_v(o: &mut Vec, v: Vec3) { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => -1.0, } } diff --git a/crates/difftest/src/units/surface_cone_p2.rs b/crates/difftest/src/units/surface_cone_p2.rs index 8614aaec63..6b9b2de3f6 100644 --- a/crates/difftest/src/units/surface_cone_p2.rs +++ b/crates/difftest/src/units/surface_cone_p2.rs @@ -431,7 +431,7 @@ fn push_v(o: &mut Vec, v: Vec3) { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => -1.0, } } diff --git a/crates/difftest/src/units/surface_cone_p3.rs b/crates/difftest/src/units/surface_cone_p3.rs index 271872a8f8..413ca23c63 100644 --- a/crates/difftest/src/units/surface_cone_p3.rs +++ b/crates/difftest/src/units/surface_cone_p3.rs @@ -327,7 +327,7 @@ impl UnitDiff for Runner { "status_{}", match e { SolidError::Upstream { code, .. } => code, - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, _ => -1, } )) diff --git a/crates/difftest/src/units/surface_curve_bounded_surface.rs b/crates/difftest/src/units/surface_curve_bounded_surface.rs index 30861247dd..1b1b7885cb 100644 --- a/crates/difftest/src/units/surface_curve_bounded_surface.rs +++ b/crates/difftest/src/units/surface_curve_bounded_surface.rs @@ -597,7 +597,7 @@ fn side(left: bool) -> Side { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_offset_surface.rs b/crates/difftest/src/units/surface_offset_surface.rs index b7d6e50829..5c00d05a97 100644 --- a/crates/difftest/src/units/surface_offset_surface.rs +++ b/crates/difftest/src/units/surface_offset_surface.rs @@ -486,7 +486,7 @@ fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), // SM_ERR_INVALID_INPUT (the zero-vector status of Unitize) - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/surface_plane_p1.rs b/crates/difftest/src/units/surface_plane_p1.rs index bf94876af0..20cf7a915a 100644 --- a/crates/difftest/src/units/surface_plane_p1.rs +++ b/crates/difftest/src/units/surface_plane_p1.rs @@ -483,7 +483,7 @@ fn b(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_plane_p2.rs b/crates/difftest/src/units/surface_plane_p2.rs index 2b5acbe00c..18e8c2af21 100644 --- a/crates/difftest/src/units/surface_plane_p2.rs +++ b/crates/difftest/src/units/surface_plane_p2.rs @@ -528,7 +528,7 @@ fn fl(x: bool) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_sphere.rs b/crates/difftest/src/units/surface_sphere.rs index 6494f1c30b..90801d9fb9 100644 --- a/crates/difftest/src/units/surface_sphere.rs +++ b/crates/difftest/src/units/surface_sphere.rs @@ -450,7 +450,7 @@ fn push_v(o: &mut Vec, v: Vec3) { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/surface_srf_in_volume.rs b/crates/difftest/src/units/surface_srf_in_volume.rs index 2f4c0a8ea4..090cfd992a 100755 --- a/crates/difftest/src/units/surface_srf_in_volume.rs +++ b/crates/difftest/src/units/surface_srf_in_volume.rs @@ -729,7 +729,7 @@ fn put_state(o: &mut Vec, c: &SrfInVolume) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surf_of_extrusion_p1.rs b/crates/difftest/src/units/surface_surf_of_extrusion_p1.rs index 672313a8a4..21413c3b5f 100644 --- a/crates/difftest/src/units/surface_surf_of_extrusion_p1.rs +++ b/crates/difftest/src/units/surface_surf_of_extrusion_p1.rs @@ -414,7 +414,7 @@ pub(crate) fn dom4(d: [f64; 4]) -> Extent2d { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. pub(crate) fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surf_of_revolution_p2.rs b/crates/difftest/src/units/surface_surf_of_revolution_p2.rs index 9d342e7d82..8a68a0ecaf 100644 --- a/crates/difftest/src/units/surface_surf_of_revolution_p2.rs +++ b/crates/difftest/src/units/surface_surf_of_revolution_p2.rs @@ -63,7 +63,7 @@ fn harness(msg: impl Into) -> HarnessError { fn status(e: &solidcore::SolidError) -> f64 { match e { solidcore::SolidError::Upstream { code, .. } => f64::from(*code), - solidcore::SolidError::InvalidInput { .. } => 1007.0, + solidcore::SolidError::InvalidInput { .. } | solidcore::SolidError::PortInvariant { .. } => 1007.0, _ => -1.0, } } diff --git a/crates/difftest/src/units/surface_surf_of_revolution_p3.rs b/crates/difftest/src/units/surface_surf_of_revolution_p3.rs index b624d33def..570f19a212 100644 --- a/crates/difftest/src/units/surface_surf_of_revolution_p3.rs +++ b/crates/difftest/src/units/surface_surf_of_revolution_p3.rs @@ -300,7 +300,7 @@ fn to_output(i: &Inputs, flat: &[f64]) -> Result { /// `SM_EFF_ZERO`, reached by `UpdateAnalyticalDomain`), else `-1`. fn status(e: &solidcore::SolidError) -> f64 { match e { - solidcore::SolidError::InvalidInput { .. } => 1007.0, + solidcore::SolidError::InvalidInput { .. } | solidcore::SolidError::PortInvariant { .. } => 1007.0, _ => super::surface_surf_of_revolution_p1::status(e), } } diff --git a/crates/difftest/src/units/surface_surface_cache_p1.rs b/crates/difftest/src/units/surface_surface_cache_p1.rs index 68f026fe61..5cba26c8f0 100644 --- a/crates/difftest/src/units/surface_surface_cache_p1.rs +++ b/crates/difftest/src/units/surface_surface_cache_p1.rs @@ -711,7 +711,7 @@ fn obj(i: i64) -> Option { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. pub(crate) fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surface_p10.rs b/crates/difftest/src/units/surface_surface_p10.rs index 86fca0841b..2b429c7610 100644 --- a/crates/difftest/src/units/surface_surface_p10.rs +++ b/crates/difftest/src/units/surface_surface_p10.rs @@ -537,7 +537,7 @@ fn build_cache(surface: &Surface, nodes: &[NodeIn]) -> Result, H /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surface_p2.rs b/crates/difftest/src/units/surface_surface_p2.rs index b03204769e..658e3dbe23 100644 --- a/crates/difftest/src/units/surface_surface_p2.rs +++ b/crates/difftest/src/units/surface_surface_p2.rs @@ -1163,7 +1163,7 @@ fn side(left: bool) -> Side { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surface_p5.rs b/crates/difftest/src/units/surface_surface_p5.rs index 5d27eb2433..4fb1a476ee 100644 --- a/crates/difftest/src/units/surface_surface_p5.rs +++ b/crates/difftest/src/units/surface_surface_p5.rs @@ -558,7 +558,7 @@ fn status(e: &SolidError) -> f64 { eprintln!("rust error: {e:?}"); } match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surface_p6.rs b/crates/difftest/src/units/surface_surface_p6.rs index daada7160e..410a1b493c 100644 --- a/crates/difftest/src/units/surface_surface_p6.rs +++ b/crates/difftest/src/units/surface_surface_p6.rs @@ -585,7 +585,7 @@ fn orient_code(o: OrientType) -> f64 { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_surface_p7.rs b/crates/difftest/src/units/surface_surface_p7.rs index 67ba1cef51..f74ab80c96 100644 --- a/crates/difftest/src/units/surface_surface_p7.rs +++ b/crates/difftest/src/units/surface_surface_p7.rs @@ -668,7 +668,7 @@ pub(crate) fn req_of(v: u8) -> Result { /// cannot return. pub(crate) fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_trim_srf_cache.rs b/crates/difftest/src/units/surface_trim_srf_cache.rs index 25bc911df8..51e13b4161 100644 --- a/crates/difftest/src/units/surface_trim_srf_cache.rs +++ b/crates/difftest/src/units/surface_trim_srf_cache.rs @@ -442,7 +442,7 @@ fn link(i: i64) -> Option { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_trim_srf_cache/native_face.rs b/crates/difftest/src/units/surface_trim_srf_cache/native_face.rs index efdb5485ae..b0be6f7c17 100644 --- a/crates/difftest/src/units/surface_trim_srf_cache/native_face.rs +++ b/crates/difftest/src/units/surface_trim_srf_cache/native_face.rs @@ -303,7 +303,7 @@ fn probes(k: &Kernel, brep: &Brep, face: FaceId, input: &Inputs) -> SolidResult< fn status(error: SolidError) -> SolidResult { match error { SolidError::Upstream { code, .. } => Ok(f64::from(code)), - SolidError::InvalidInput { .. } => Ok(1007.0), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(1007.0), other => Err(other), } } diff --git a/crates/difftest/src/units/surface_twist_volume.rs b/crates/difftest/src/units/surface_twist_volume.rs index d6cb0d09c6..53f4a75cd5 100644 --- a/crates/difftest/src/units/surface_twist_volume.rs +++ b/crates/difftest/src/units/surface_twist_volume.rs @@ -386,7 +386,7 @@ fn ext(d: &[[f64; 3]; 2]) -> Extent3d { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_unbend_volume.rs b/crates/difftest/src/units/surface_unbend_volume.rs index 5be28819b6..20d69979c0 100644 --- a/crates/difftest/src/units/surface_unbend_volume.rs +++ b/crates/difftest/src/units/surface_unbend_volume.rs @@ -442,7 +442,7 @@ fn ext(d: &[[f64; 3]; 2]) -> Extent3d { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_volume_p1.rs b/crates/difftest/src/units/surface_volume_p1.rs index d879c0a843..507001e9bc 100644 --- a/crates/difftest/src/units/surface_volume_p1.rs +++ b/crates/difftest/src/units/surface_volume_p1.rs @@ -605,7 +605,7 @@ fn str_codes(o: &mut Vec, s: &str) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/surface_volume_p2.rs b/crates/difftest/src/units/surface_volume_p2.rs index 5fa212f8a6..a3cd6b9a7c 100644 --- a/crates/difftest/src/units/surface_volume_p2.rs +++ b/crates/difftest/src/units/surface_volume_p2.rs @@ -730,7 +730,7 @@ fn put_solutions(o: &mut Vec, found: bool, sols: &SolutionArray) { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/sweep_api_brep.rs b/crates/difftest/src/units/sweep_api_brep.rs index 32722237d8..1bf9a50d57 100644 --- a/crates/difftest/src/units/sweep_api_brep.rs +++ b/crates/difftest/src/units/sweep_api_brep.rs @@ -500,7 +500,7 @@ fn options_of(o: Option<[bool; 5]>) -> Option { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/sweep_api_surfaces.rs b/crates/difftest/src/units/sweep_api_surfaces.rs index 8e98a01c74..3b29ad61f4 100644 --- a/crates/difftest/src/units/sweep_api_surfaces.rs +++ b/crates/difftest/src/units/sweep_api_surfaces.rs @@ -445,7 +445,7 @@ fn dump_surface(o: &mut Vec, s: &BSplineSurface) { /// The `SmStatus` of a Rust error; `-1` for one upstream cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/sweep_rotational_sweep_geometry.rs b/crates/difftest/src/units/sweep_rotational_sweep_geometry.rs index 08aa562f74..a919f9d21e 100644 --- a/crates/difftest/src/units/sweep_rotational_sweep_geometry.rs +++ b/crates/difftest/src/units/sweep_rotational_sweep_geometry.rs @@ -408,7 +408,7 @@ fn run_cpp(i: &Inputs) -> Result { /// cannot return. fn status(e: &SolidError) -> f64 { match e { - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, SolidError::Upstream { code, .. } => f64::from(*code), _ => -1.0, } diff --git a/crates/difftest/src/units/sweep_topology_sweep.rs b/crates/difftest/src/units/sweep_topology_sweep.rs index 448de63c10..552d038cb9 100644 --- a/crates/difftest/src/units/sweep_topology_sweep.rs +++ b/crates/difftest/src/units/sweep_topology_sweep.rs @@ -86,7 +86,7 @@ fn entity_id(e: Option) -> i64 { fn status(e: &SolidError) -> i64 { match e { SolidError::Upstream { code, .. } => i64::from(*code), - SolidError::InvalidInput { .. } => 1007, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007, SolidError::Nlib { .. } => 1001, _ => -1, } diff --git a/crates/difftest/src/units/sweep_trans_sweep_geometry.rs b/crates/difftest/src/units/sweep_trans_sweep_geometry.rs index 85acf148e3..83c8e68c94 100644 --- a/crates/difftest/src/units/sweep_trans_sweep_geometry.rs +++ b/crates/difftest/src/units/sweep_trans_sweep_geometry.rs @@ -80,7 +80,7 @@ fn v(p: [f64; 3]) -> Vec3 { fn status(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007., + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007., SolidError::Nlib { .. } => 1001., _ => -1., } diff --git a/crates/difftest/src/units/topology_brep_mirror.rs b/crates/difftest/src/units/topology_brep_mirror.rs index b37a8043db..649a79901a 100644 --- a/crates/difftest/src/units/topology_brep_mirror.rs +++ b/crates/difftest/src/units/topology_brep_mirror.rs @@ -127,7 +127,7 @@ pub(super) fn status(r: SolidResult<()>) -> SolidResult { Ok(()) => Ok(0.), Err(e) if e.is_unported() => Err(e), Err(SolidError::Upstream { code, .. }) => Ok(f64::from(code)), - Err(SolidError::InvalidInput { .. }) => Ok(1007.), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(1007.), Err(e) => Err(e), } } diff --git a/crates/difftest/src/units/topology_brep_p1.rs b/crates/difftest/src/units/topology_brep_p1.rs index ba8ce94932..4e0396fd21 100644 --- a/crates/difftest/src/units/topology_brep_p1.rs +++ b/crates/difftest/src/units/topology_brep_p1.rs @@ -1043,10 +1043,10 @@ const SM_ERR_INVALID_INPUT: f64 = 1007.0; fn status_of(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { operation, .. } if *operation == "topology::brep::p1" => { + SolidError::InvalidInput { operation, .. } | SolidError::PortInvariant { operation, .. } if *operation == "topology::brep::p1" => { NULL_DEREF } - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => -9.0, } } diff --git a/crates/difftest/src/units/topology_brep_p10.rs b/crates/difftest/src/units/topology_brep_p10.rs index 7e61d2e20c..957077cb25 100644 --- a/crates/difftest/src/units/topology_brep_p10.rs +++ b/crates/difftest/src/units/topology_brep_p10.rs @@ -314,7 +314,7 @@ fn builds(i: &Inputs, data: &BrepData) -> bool { }; !matches!( make_topology_from_data(&mut k, &mut b, &mut data, &mut env, options), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) ) } @@ -400,7 +400,7 @@ fn cpp(i: &Inputs) -> Result { fn status(e: &SolidError) -> i64 { match e { SolidError::Upstream { code, .. } => i64::from(*code), - SolidError::InvalidInput { .. } => -2, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => -2, _ => -1, } } diff --git a/crates/difftest/src/units/topology_brep_p5.rs b/crates/difftest/src/units/topology_brep_p5.rs index 87046a9d40..1beabbbf24 100644 --- a/crates/difftest/src/units/topology_brep_p5.rs +++ b/crates/difftest/src/units/topology_brep_p5.rs @@ -88,7 +88,7 @@ fn status(r: SolidResult<()>) -> SolidResult { Ok(()) => Ok(0.), Err(e) if e.is_unported() => Err(e), Err(SolidError::Upstream { code, .. }) => Ok(f64::from(code)), - Err(SolidError::InvalidInput { .. }) => Ok(1007.), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(1007.), Err(e) => Err(e), } } diff --git a/crates/difftest/src/units/topology_brep_p7.rs b/crates/difftest/src/units/topology_brep_p7.rs index c71c29591e..d5b0f082c0 100644 --- a/crates/difftest/src/units/topology_brep_p7.rs +++ b/crates/difftest/src/units/topology_brep_p7.rs @@ -684,7 +684,7 @@ fn status(r: &Result) -> Result { match r { Ok(_) => Ok(0.0), Err(SolidError::Upstream { code, .. }) => Ok(f64::from(*code)), - Err(SolidError::InvalidInput { .. }) => Ok(SM_ERR_INVALID_INPUT), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(SM_ERR_INVALID_INPUT), Err(e) => Err(match Output::unported(e) { Some(o) => Fail::Deferred(Box::new(o)), None => hfail(format!("rust: {e}")), diff --git a/crates/difftest/src/units/topology_brep_p8.rs b/crates/difftest/src/units/topology_brep_p8.rs index ba4f779c25..5a072e37a4 100644 --- a/crates/difftest/src/units/topology_brep_p8.rs +++ b/crates/difftest/src/units/topology_brep_p8.rs @@ -447,7 +447,7 @@ fn status(r: &Result) -> Result { "SmTrimmingTools::FindOuterLoops", )))), Err(SolidError::Upstream { code, .. }) => Ok(f64::from(*code)), - Err(SolidError::InvalidInput { .. }) => Ok(1007.0), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(1007.0), Err(e) => Err(match Output::unported(e) { Some(o) => Fail::Deferred(Box::new(o)), None => hfail(format!("rust: {e}")), diff --git a/crates/difftest/src/units/topology_database_io.rs b/crates/difftest/src/units/topology_database_io.rs index 0fa2cf1ac7..0e27b6d756 100644 --- a/crates/difftest/src/units/topology_database_io.rs +++ b/crates/difftest/src/units/topology_database_io.rs @@ -186,7 +186,7 @@ fn output(open_status: i64, recs: &[Rec]) -> Output { /// Status for a Rust error (see module docs). fn status_of(e: &SolidError) -> Result { match e { - SolidError::InvalidInput { .. } => Ok(ST_SHORT), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(ST_SHORT), SolidError::Upstream { code, .. } => Ok(i64::from(*code)), other => Err(HarnessError::new(format!("unexpected error {other}"))), } diff --git a/crates/difftest/src/units/topology_edgeuse_p1.rs b/crates/difftest/src/units/topology_edgeuse_p1.rs index 0d6af6ada7..f7bc749766 100644 --- a/crates/difftest/src/units/topology_edgeuse_p1.rs +++ b/crates/difftest/src/units/topology_edgeuse_p1.rs @@ -1455,7 +1455,7 @@ pub(crate) fn import_raw_with_types(ex: &[f64]) -> Result<(Brep, ImportTypes), H fn slot(r: Result, f: impl FnOnce(T) -> i64) -> Result { match r { Ok(v) => Ok(f(v)), - Err(SolidError::InvalidInput { .. }) => Ok(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(NULL_DEREF), Err(e) => Err(e), } } @@ -1680,7 +1680,7 @@ fn eu_state(k: &Kernel, b: &Brep, eu: Option, out: &mut Vec) -> fn status_of(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => NULL_DEREF as f64, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => NULL_DEREF as f64, _ => -9.0, } } @@ -1840,7 +1840,7 @@ fn run_rust_brep(k: &Kernel, b: &mut Brep, op: &OpIn) -> Result { let e = eid(*eu); let mate = match eu1::mate(b, e) { Ok(m) => m, - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { return Ok(Output::new().values("state", vec![NULL_DEREF as f64])) } Err(x) => return Err(x.into()), @@ -1872,7 +1872,7 @@ fn run_rust_brep(k: &Kernel, b: &mut Brep, op: &OpIn) -> Result { }; match r { Ok(()) => {} - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { return Ok(Output::new().values("state", vec![NULL_DEREF as f64])) } Err(x) => return Err(x.into()), diff --git a/crates/difftest/src/units/topology_edgeuse_p2.rs b/crates/difftest/src/units/topology_edgeuse_p2.rs index 41dea5b048..fcc8994d69 100644 --- a/crates/difftest/src/units/topology_edgeuse_p2.rs +++ b/crates/difftest/src/units/topology_edgeuse_p2.rs @@ -613,7 +613,7 @@ fn run_rust_op( let mate = eu1::mate(b, eu); let r = eu2::check_and_set_uv_trim_curve(&k, b, eu, curve, *adjust, rec.as_mut()); match (r, mate) { - (Err(e), _) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => { + (Err(e), _) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { Err(e) } (_, Err(e)) => Err(e), @@ -702,7 +702,7 @@ fn run_rust(i: &Inputs) -> Result { return Ok(o); } match e { - SolidError::InvalidInput { .. } => Ok(Output::err("null_deref")), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(Output::err("null_deref")), e => Err(harness(format!("rust: {e}"))), } } diff --git a/crates/difftest/src/units/topology_edgeuse_p3.rs b/crates/difftest/src/units/topology_edgeuse_p3.rs index f3afe5f717..e73c9adb02 100644 --- a/crates/difftest/src/units/topology_edgeuse_p3.rs +++ b/crates/difftest/src/units/topology_edgeuse_p3.rs @@ -516,7 +516,7 @@ fn run_rust(i: &Inputs) -> Result { "SmSurfaceCache::SubdivideToTolerances past MAX_SUBDIVISION_NODES (port bound)", )) } - SolidError::InvalidInput { .. } => Ok(Output::err("null_deref")), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => Ok(Output::err("null_deref")), e => Err(harness(format!("rust: {e}"))), } } diff --git a/crates/difftest/src/units/topology_face_p1.rs b/crates/difftest/src/units/topology_face_p1.rs index d69bb3a331..267f247674 100644 --- a/crates/difftest/src/units/topology_face_p1.rs +++ b/crates/difftest/src/units/topology_face_p1.rs @@ -411,7 +411,7 @@ fn status(r: &Result) -> Result { match r { Ok(_) => Ok(0.0), Err(SolidError::Upstream { code, .. }) => Ok(f64::from(*code)), - Err(SolidError::InvalidInput { .. }) => Ok(SM_ERR_INVALID_INPUT), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(SM_ERR_INVALID_INPUT), Err(e) => Err(fail(e)), } } diff --git a/crates/difftest/src/units/topology_face_p2.rs b/crates/difftest/src/units/topology_face_p2.rs index ded0caeebe..83c1aa7d76 100644 --- a/crates/difftest/src/units/topology_face_p2.rs +++ b/crates/difftest/src/units/topology_face_p2.rs @@ -1755,7 +1755,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { o.extend([p.x, p.y, p.z]); } } - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => o.extend([status_of(e)?, 0.0]), } } @@ -1792,7 +1792,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { } } } - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => o.extend([status_of(e)?, 0.0, 0.0, 0.0, 0.0, 0.0]), }, OpIn::Trim { @@ -1841,7 +1841,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { None => o.push(-1.0), } } - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => o.extend([ status_of(e)?, if *want_3d { 0.0 } else { -1.0 }, @@ -1898,7 +1898,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { }; match fp2::fix_uv_trim_curves(&k, b, cur, p, v, *tol, *dist, &dom) { Ok(fixed) => o.extend([0.0, flag(fixed)]), - Err(SolidError::InvalidInput { .. }) => return Ok(vec![NULL_DEREF]), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => return Ok(vec![NULL_DEREF]), Err(e) => o.extend([status_of(e)?, 0.0]), } put_curve(&mut o, uv_of(b, Some(cur))?.as_ref())?; @@ -1936,7 +1936,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { o.push(which.map_or(-1.0, |w| w as f64)); put_curve(&mut o, found.as_ref())?; } - Err(SolidError::InvalidInput { .. }) => return Ok(vec![NULL_DEREF]), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => return Ok(vec![NULL_DEREF]), Err(e) => o.extend([status_of(e)?, -1.0, -1.0]), } o.extend(slots.iter().map(|s| flag(s.is_some()))); @@ -1952,7 +1952,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result, Fail> { flag(r.on_singularity), flag(r.crosses_missing_seam), ]), - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => return Err(e.into()), }, OpIn::Rescue { f, to_null } => { diff --git a/crates/difftest/src/units/topology_face_p4.rs b/crates/difftest/src/units/topology_face_p4.rs index da08266da6..10acc634be 100644 --- a/crates/difftest/src/units/topology_face_p4.rs +++ b/crates/difftest/src/units/topology_face_p4.rs @@ -443,7 +443,7 @@ fn put_list(o: &mut Vec, r: Result, SolidError>) -> Resu o.push(v.len() as f64); o.extend(v.iter().map(|x| f64::from(x.index()))); } - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => return Err(fail(&e)), } Ok(()) @@ -768,7 +768,7 @@ fn rust_record(i: &Inputs, mut b: Brep) -> Result, Fail> { OpIn::Connected { kind, index } => match fp4::is_connected_to(&b, f, target(*kind, *index)) { Ok(c) => o.push(flag(c)), - Err(SolidError::InvalidInput { .. }) => o.push(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.push(NULL_DEREF), Err(e) => return Err(fail(&e)), }, OpIn::Line { diff --git a/crates/difftest/src/units/topology_face_p4/level0.rs b/crates/difftest/src/units/topology_face_p4/level0.rs index 24b081ebc3..58c47134bb 100644 --- a/crates/difftest/src/units/topology_face_p4/level0.rs +++ b/crates/difftest/src/units/topology_face_p4/level0.rs @@ -178,7 +178,7 @@ fn rust_record(op: &Level0Op, b: &Brep, c: [usize; 10]) -> Result, Soli ]), // the intersector-form trim polygon of fewer than four points the // shim skips (upstream reads `lNum - 4`) - Err(SolidError::InvalidInput { reason, .. }) + Err(SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. }) if reason.contains("fewer than four control points") => { o.extend([SKIPPED; 2]); diff --git a/crates/difftest/src/units/topology_loopuse.rs b/crates/difftest/src/units/topology_loopuse.rs index 701932e80f..a7afc6cbc4 100644 --- a/crates/difftest/src/units/topology_loopuse.rs +++ b/crates/difftest/src/units/topology_loopuse.rs @@ -506,7 +506,7 @@ impl From for Fail { fn slot(r: Result) -> Result, Fail> { match r { Ok(v) => Ok(Some(v)), - Err(SolidError::InvalidInput { .. }) => Ok(None), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(None), Err(e) => Err(fail(&e)), } } diff --git a/crates/difftest/src/units/topology_proto_topology_p1.rs b/crates/difftest/src/units/topology_proto_topology_p1.rs index 7237a73ca7..d6b87e6ee6 100644 --- a/crates/difftest/src/units/topology_proto_topology_p1.rs +++ b/crates/difftest/src/units/topology_proto_topology_p1.rs @@ -717,7 +717,7 @@ const REFUSED: f64 = f64::MIN; /// refusal, as the shim refuses those inputs. fn st3(r: solidcore::Result) -> Result, Fail> { match r { - Err(SolidError::InvalidInput { .. }) => Ok(Err(REFUSED)), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(Err(REFUSED)), r => st(r), } } @@ -2805,7 +2805,7 @@ fn run_proto( &mut output, ) .map_err(|error| match error { - SolidError::InvalidInput { operation, .. } => SolidError::Upstream { + SolidError::InvalidInput { operation, .. } | SolidError::PortInvariant { operation, .. } => SolidError::Upstream { operation, code: solidcore::error::SM_ERR_INVALID_INPUT, entity: None, @@ -5090,7 +5090,7 @@ fn transform_status(res: solidcore::Result<()>) -> Result { Err(e) => match Output::unported(&e) { Some(d) => return Err(Fail::Deferred(Box::new(d))), None => match e { - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, e => status(&e), }, }, diff --git a/crates/difftest/src/units/topology_proto_topology_p2.rs b/crates/difftest/src/units/topology_proto_topology_p2.rs index 5f6d2419ff..cc229f4ae1 100644 --- a/crates/difftest/src/units/topology_proto_topology_p2.rs +++ b/crates/difftest/src/units/topology_proto_topology_p2.rs @@ -71,7 +71,7 @@ fn res(r: solidcore::Result, status_out: &mut f64, skip: &mut bool) -> Res if let Some(o) = Output::unported(&e) { return Err(Fail::Deferred(Box::new(o))); } - if matches!(e, SolidError::InvalidInput { .. }) { + if matches!(e, SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) { *skip = true; } else { *status_out = status(&e); diff --git a/crates/difftest/src/units/topology_trimming_tools.rs b/crates/difftest/src/units/topology_trimming_tools.rs index 2fcf6f4534..22639d284c 100644 --- a/crates/difftest/src/units/topology_trimming_tools.rs +++ b/crates/difftest/src/units/topology_trimming_tools.rs @@ -1188,7 +1188,7 @@ fn find_outer( o.push(0.0); put_outer(o, &ordered, &counts, &orients, normal, &outer); } - Err(SolidError::InvalidInput { .. }) => o.extend([0.0, NULL_DEREF]), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => o.extend([0.0, NULL_DEREF]), Err(e) => { o.push(status::<()>(&Err(e))?); } diff --git a/crates/difftest/src/units/topology_vertex.rs b/crates/difftest/src/units/topology_vertex.rs index d4e0299ade..f6f33b34d1 100644 --- a/crates/difftest/src/units/topology_vertex.rs +++ b/crates/difftest/src/units/topology_vertex.rs @@ -1498,7 +1498,7 @@ impl From for Fail { fn or_null(r: Result) -> Result, SolidError> { match r { Ok(v) => Ok(Some(v)), - Err(SolidError::InvalidInput { .. }) => Ok(None), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(None), Err(e) => Err(e), } } diff --git a/crates/difftest/src/units/topology_vertexuse.rs b/crates/difftest/src/units/topology_vertexuse.rs index 3bf3e2e491..69b6ef7420 100644 --- a/crates/difftest/src/units/topology_vertexuse.rs +++ b/crates/difftest/src/units/topology_vertexuse.rs @@ -1309,7 +1309,7 @@ impl From for Fail { fn slot(r: Result, f: impl FnOnce(T) -> i64) -> Result { match r { Ok(v) => Ok(f(v)), - Err(SolidError::InvalidInput { .. }) => Ok(NULL_DEREF), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => Ok(NULL_DEREF), Err(e) => Err(e), } } @@ -1651,7 +1651,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result { }; match r { Ok(x) => out.extend(x), - Err(SolidError::InvalidInput { .. }) => { + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => { return Ok(Output::new().values("state", vec![NULL_DEREF as f64])) } Err(e) => return Err(e.into()), @@ -1685,7 +1685,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result { OpIn::UvPoint { vu, ok_to_make } => { match vu1::compute_uv_point(&k, b, vid(*vu), *ok_to_make) { Ok(p) => vec![0.0, p.x, p.y], - Err(SolidError::InvalidInput { .. }) => vec![NULL_DEREF as f64], + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => vec![NULL_DEREF as f64], Err(e) => vec![ status_of(&e)?, solidcore::math::UNDEF_DOUBLE, @@ -1731,7 +1731,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result { ); out } - Err(SolidError::InvalidInput { .. }) => vec![NULL_DEREF as f64], + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => vec![NULL_DEREF as f64], Err(e) => return Err(e.into()), } } @@ -1747,7 +1747,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result { if *want_u { i64::from(m.u) } else { -1 }, if *want_v { i64::from(m.v) } else { -1 }, ], - Err(SolidError::InvalidInput { .. }) => vec![NULL_DEREF], + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => vec![NULL_DEREF], Err(e) => return Err(e.into()), }; return Ok(Output::new().ints("q", q)); @@ -1758,7 +1758,7 @@ fn run_rust_op(b: &mut Brep, op: &OpIn) -> Result { gap_states(b, &mut out); out } - Err(SolidError::InvalidInput { .. }) => vec![NULL_DEREF as f64], + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => vec![NULL_DEREF as f64], Err(e) => return Err(e.into()), }, }; diff --git a/crates/solidcore/src/blend/fillet_corner/p1.rs b/crates/solidcore/src/blend/fillet_corner/p1.rs index 908c327a93..33cea47bfa 100644 --- a/crates/solidcore/src/blend/fillet_corner/p1.rs +++ b/crates/solidcore/src/blend/fillet_corner/p1.rs @@ -1185,7 +1185,10 @@ pub fn check_nx1_degeneracy_status( match eu3::evaluate_binormal(k, b, eu, t, false, &options) { Ok(e) => Ok(Ok(e.face_normal)), Err(e @ (SolidError::Unported { .. } | SolidError::NotFound { .. })) => Err(e), - Err(e @ SolidError::InvalidInput { reason, .. }) if reason == NULL_DEREF => Err(e), + Err( + e @ (SolidError::InvalidInput { reason, .. } + | SolidError::PortInvariant { reason, .. }), + ) if reason == NULL_DEREF => Err(e), Err(e) => Ok(Err(e)), } }; diff --git a/crates/solidcore/src/blend/fillet_corner/p2.rs b/crates/solidcore/src/blend/fillet_corner/p2.rs index 9a95aac480..1128c1dd6f 100644 --- a/crates/solidcore/src/blend/fillet_corner/p2.rs +++ b/crates/solidcore/src/blend/fillet_corner/p2.rs @@ -1315,7 +1315,11 @@ impl FilletCorner { ) -> Result { match self.analytic_corner_surface(env) { Ok(made) => Ok(made), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), // `return sErr` / `return SM_ERR_NULL_POINTER` as an SmBoolean Err(_) => Ok(true), } @@ -2199,7 +2203,11 @@ fn unitize_ser(v: Vec3, operation: &'static str) -> Result { fn soft(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/blend/fillet_corner/topology/concave_4x2.rs b/crates/solidcore/src/blend/fillet_corner/topology/concave_4x2.rs index 0e163183bc..e86ed26fd7 100644 --- a/crates/solidcore/src/blend/fillet_corner/topology/concave_4x2.rs +++ b/crates/solidcore/src/blend/fillet_corner/topology/concave_4x2.rs @@ -40,7 +40,7 @@ use crate::topology::{Brep, EdgeuseId, VertexId}; fn status_angle(e: &SolidError) -> f64 { let code = match e { SolidError::Upstream { code, .. } => *code, - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => SM_ERR, }; f64::from(code) diff --git a/crates/solidcore/src/blend/fillet_corner/topology/nx1_end.rs b/crates/solidcore/src/blend/fillet_corner/topology/nx1_end.rs index 7da4e61138..b653258327 100644 --- a/crates/solidcore/src/blend/fillet_corner/topology/nx1_end.rs +++ b/crates/solidcore/src/blend/fillet_corner/topology/nx1_end.rs @@ -47,7 +47,7 @@ fn invalid(reason: &'static str) -> SolidError { fn status_of(e: &SolidError) -> i32 { match e { SolidError::Upstream { code, .. } => *code, - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => SM_ERR, } } diff --git a/crates/solidcore/src/blend/fillet_executive/p1.rs b/crates/solidcore/src/blend/fillet_executive/p1.rs index 14dbdc1e72..0b04dad5d3 100644 --- a/crates/solidcore/src/blend/fillet_executive/p1.rs +++ b/crates/solidcore/src/blend/fillet_executive/p1.rs @@ -1428,6 +1428,7 @@ pub fn remove_topo_edges(k: &mut Kernel, b: &mut Brep, edges: &[Option]) if let Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) = brep_p5::delete_topological_vertex(k, b, editing, Some(vertex), None) { diff --git a/crates/solidcore/src/blend/fillet_executive/p3_tests.rs b/crates/solidcore/src/blend/fillet_executive/p3_tests.rs index 63c2f03615..b47dbf737d 100644 --- a/crates/solidcore/src/blend/fillet_executive/p3_tests.rs +++ b/crates/solidcore/src/blend/fillet_executive/p3_tests.rs @@ -760,7 +760,7 @@ fn uninitialized_changes_only_generic_error_members() { let mut k = Kernel::default(); assert!(matches!( executive.do_fillet(&mut k, &mut access), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) )); assert_eq!(executive.error.code, 1); assert_eq!(executive.error.status, 9); diff --git a/crates/solidcore/src/blend/fillet_solver/p1.rs b/crates/solidcore/src/blend/fillet_solver/p1.rs index a7fb8a16f6..bf8cd91695 100644 --- a/crates/solidcore/src/blend/fillet_solver/p1.rs +++ b/crates/solidcore/src/blend/fillet_solver/p1.rs @@ -173,7 +173,9 @@ fn invalid(reason: &'static str) -> SolidError { /// upstream, not a status) pass through. fn as_sm_err(e: SolidError, op: &'static str) -> SolidError { match e { - SolidError::Unported { .. } | SolidError::InvalidInput { .. } => e, + SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } => e, _ => SolidError::sm_err(op), } } @@ -3060,7 +3062,9 @@ fn binormal_status_ignored( if e.is_unported() || matches!( e, - SolidError::NotFound { .. } | SolidError::InvalidInput { .. } + SolidError::NotFound { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } ) => { Err(e) diff --git a/crates/solidcore/src/blend/fillet_solver/p5/tests.rs b/crates/solidcore/src/blend/fillet_solver/p5/tests.rs index 636c95f62a..c9a98e7056 100644 --- a/crates/solidcore/src/blend/fillet_solver/p5/tests.rs +++ b/crates/solidcore/src/blend/fillet_solver/p5/tests.rs @@ -551,7 +551,10 @@ fn a_broken_corner_callee_cannot_spin_the_segment_walk_forever() { ..Script::default() }; let result = f.context().process(id, &mut vec![], &mut script); - assert!(matches!(result, Err(SolidError::InvalidInput { .. }))); + assert!(matches!( + result, + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) + )); assert_eq!(script.find_count, 44); } #[test] @@ -1049,7 +1052,7 @@ fn rollover_trim_uses_the_live_solver_at_its_nonzero_id() { &f.solver, &f.target ), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) )); } diff --git a/crates/solidcore/src/blend/fillet_standard_solver/p2.rs b/crates/solidcore/src/blend/fillet_standard_solver/p2.rs index 6ff060c6a9..713b941a15 100644 --- a/crates/solidcore/src/blend/fillet_standard_solver/p2.rs +++ b/crates/solidcore/src/blend/fillet_standard_solver/p2.rs @@ -203,7 +203,9 @@ fn interval_at<'a>(ivls: &'a mut ExtentNd, i: usize, op: &'static str) -> Result /// out of bounds) are kept. fn as_sm_err(e: SolidError, op: &'static str) -> SolidError { match e { - SolidError::Unported { .. } | SolidError::InvalidInput { .. } => e, + SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } => e, _ => SolidError::sm_err(op), } } diff --git a/crates/solidcore/src/boolean/merge/p2.rs b/crates/solidcore/src/boolean/merge/p2.rs index 924842edf5..de0604a54d 100644 --- a/crates/solidcore/src/boolean/merge/p2.rs +++ b/crates/solidcore/src/boolean/merge/p2.rs @@ -829,9 +829,11 @@ pub fn make_faceuse_attempt_with( None, ) { Ok(sector) => sector.radial_edgeuse, - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => { - return Err(e) - } + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => return Err(e), Err(_) => None, }; // add the classified radial sector's Edgeuse to the sFaceEdgeuses list @@ -1373,7 +1375,11 @@ fn null_first(list: &mut [Option], item: O) { fn ignore_soft(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/boolean/merge/p3.rs b/crates/solidcore/src/boolean/merge/p3.rs index 1975c35765..d07bb4e7ea 100644 --- a/crates/solidcore/src/boolean/merge/p3.rs +++ b/crates/solidcore/src/boolean/merge/p3.rs @@ -336,7 +336,12 @@ pub fn boolean_trees( .map_err(|e| { // undefined behaviour the port detects (InvalidInput) keeps its // error, as Unported does - if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) { + if e.is_unported() + || matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) + { e } else { SolidError::sm_err(OP) diff --git a/crates/solidcore/src/boolean/topology_intersector/p1.rs b/crates/solidcore/src/boolean/topology_intersector/p1.rs index fcbc94cffb..c88a7eca60 100644 --- a/crates/solidcore/src/boolean/topology_intersector/p1.rs +++ b/crates/solidcore/src/boolean/topology_intersector/p1.rs @@ -235,7 +235,11 @@ pub(super) const fn dangling(reason: &'static str) -> SolidError { pub(super) fn ignore_soft(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/boolean/topology_intersector/p2.rs b/crates/solidcore/src/boolean/topology_intersector/p2.rs index e31ce2ce26..4c3f3d45e9 100644 --- a/crates/solidcore/src/boolean/topology_intersector/p2.rs +++ b/crates/solidcore/src/boolean/topology_intersector/p2.rs @@ -1903,9 +1903,11 @@ impl TopologyIntersector { // Do the intersection. let split = match super::p1::test_and_split_two_edges(k, brep, e1, e2, this_tol) { Ok(s) => s, - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => { - return Err(e) - } + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => return Err(e), Err(e) => { if ignore_problems { continue; @@ -2198,7 +2200,8 @@ impl TopologyIntersector { Ok(()) => out.imprinted_edges.push(e), Err( err @ (SolidError::Unported { .. } - | SolidError::InvalidInput { .. }), + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), ) => return Err(err), Err(_) => { if !ignore_problems { diff --git a/crates/solidcore/src/curve/curve/p1.rs b/crates/solidcore/src/curve/curve/p1.rs index 2d9d3bf68c..49db52a3b0 100644 --- a/crates/solidcore/src/curve/curve/p1.rs +++ b/crates/solidcore/src/curve/curve/p1.rs @@ -152,7 +152,7 @@ fn first_n(v: &[Vec3]) -> [Vec3; N] { fn status_value(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => 1001.0, } } diff --git a/crates/solidcore/src/curve/curve/p9.rs b/crates/solidcore/src/curve/curve/p9.rs index 9f5cc1f9bd..9681d4aa1a 100644 --- a/crates/solidcore/src/curve/curve/p9.rs +++ b/crates/solidcore/src/curve/curve/p9.rs @@ -157,7 +157,7 @@ fn set_param(end: &mut SolutionEnd, i: usize, v: f64) -> Result<()> { fn status_value(e: &SolidError) -> f64 { match e { SolidError::Upstream { code, .. } => f64::from(*code), - SolidError::InvalidInput { .. } => 1007.0, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => 1007.0, _ => 1001.0, } } diff --git a/crates/solidcore/src/error.rs b/crates/solidcore/src/error.rs index b954a58a97..2da2c0a4c3 100644 --- a/crates/solidcore/src/error.rs +++ b/crates/solidcore/src/error.rs @@ -8,6 +8,8 @@ //! | [`SolidError`] | non-`SM_SUCCESS` `SmStatus` values | //! | [`SolidError::InvalidInput`]| `SM_ERR_INVALID_INPUT` | //! | [`SolidError::Upstream`] | any other `SM_ERR_*` code, carried numerically | +//! | [`SolidError::PortInvariant`] | none: a port-side invariant or adapter failure | +//! | [`SolidError::sm_status`] | the `SmStatus` an error stands for, when exact | //! | [`SM_ERR`], [`SM_ERR_WARNING`], [`SolidError::sm_err`] | `SM_ERR`, `SM_ERR_WARNING`, `SE(SM_ERR)` | //! | [`SM_ERR_NULL_POINTER`], [`SolidError::null_pointer`] | `SM_ERR_NULL_POINTER`, `NER(...)` on `NULL` | //! | [`SolidError::Nlib`], [`SolidError::nlib`] | NLib error flag + `NL_ERROR.eno` (`N_ErrSet`) | @@ -168,6 +170,21 @@ pub enum SolidError { code: NlibCode, }, + /// A port-side invariant or adapter failure with no upstream `SmStatus`: an owner, + /// handle or identity the port could not resolve where upstream follows a pointer + /// (e.g. a B-rep cache owner that is not in the source B-rep under the caller's + /// identities). It signals a caller error or a solidcore defect, never a status an + /// upstream caller handles, so [`SolidError::sm_status`] is `None`. Code that + /// treated these as [`SolidError::InvalidInput`] before the variant existed matches + /// both, so results and difftest statuses are unchanged. + #[error("{operation}: port invariant: {reason}")] + PortInvariant { + /// Operation whose invariant failed. + operation: &'static str, + /// What did not hold. + reason: &'static str, + }, + /// An operation-local read-only solve needs its mutable caller to prepare geometry. /// This control signal is not an unported dependency or a native status. #[error("{operation}: geometry preparation required")] @@ -319,6 +336,42 @@ impl SolidError { Self::InvalidInput { operation, reason } } + /// [`SolidError::PortInvariant`]: a port-side invariant or adapter failure with no + /// upstream status. + #[must_use] + pub const fn port_invariant(operation: &'static str, reason: &'static str) -> Self { + Self::PortInvariant { operation, reason } + } + + /// The upstream `SmStatus` this error stands for, when it stands for one exactly: + /// + /// - [`SolidError::Upstream`]: its `code`. + /// - [`SolidError::Nlib`]: [`SM_ERR`]. The `Sm*` callers of an NLib routine + /// surface its failure as `SER(SM_ERR)` (`if (NL_YES == N_...) SER(SM_ERR)`; + /// `nl_ser`), never as the `NL_*_ERR` number. + /// - Every other variant: `None`. [`SolidError::InvalidInput`], + /// [`SolidError::NotFound`], [`SolidError::Degenerate`], + /// [`SolidError::NotConverged`] and [`SolidError::Unsupported`] are used both for + /// mapped upstream statuses and for port-side checks, so they are not exact; a + /// port that must surface a status exactly returns [`SolidError::Upstream`] with + /// it. [`SolidError::PortInvariant`], [`SolidError::Unported`] and + /// [`SolidError::PreparationRequired`] never stand for one. + #[must_use] + pub const fn sm_status(&self) -> Option { + match self { + Self::Upstream { code, .. } => Some(*code), + Self::Nlib { .. } => Some(SM_ERR), + Self::InvalidInput { .. } + | Self::NotFound { .. } + | Self::Degenerate { .. } + | Self::NotConverged { .. } + | Self::Unsupported { .. } + | Self::PortInvariant { .. } + | Self::PreparationRequired { .. } + | Self::Unported { .. } => None, + } + } + /// [`SolidError::Unported`]: a call into `upstream` (a C++ symbol) of `unit`, /// which is not ported yet. Every site carries `// UNPORTED(): `. #[must_use] @@ -349,6 +402,7 @@ impl SolidError { | Self::Degenerate { operation, .. } | Self::NotConverged { operation, .. } | Self::Unsupported { operation, .. } + | Self::PortInvariant { operation, .. } | Self::Upstream { operation, .. } | Self::Nlib { operation, .. } | Self::PreparationRequired { operation } => operation, @@ -365,6 +419,7 @@ impl SolidError { Self::InvalidInput { .. } | Self::NotConverged { .. } | Self::Unsupported { .. } + | Self::PortInvariant { .. } | Self::Nlib { .. } | Self::Unported { .. } | Self::PreparationRequired { .. } => None, @@ -388,6 +443,87 @@ mod tests { assert_eq!(SolidError::nl_ser("native")(request.clone()), request); } + #[test] + fn sm_status_is_some_only_for_exact_upstream_statuses() { + let f = FaceId::from_index(1); + let cases = [ + (SolidError::sm_err("op"), Some(SM_ERR)), + (SolidError::null_pointer("op"), Some(SM_ERR_NULL_POINTER)), + ( + SolidError::Upstream { + operation: "op", + code: SM_ERR_INVALID_INPUT, + entity: Some(EntityRef::Face(f)), + }, + Some(1007), + ), + ( + SolidError::Upstream { + operation: "op", + code: SM_ERR_WARNING, + entity: None, + }, + Some(1023), + ), + (SolidError::nlib("op", NlibCode::Knot), Some(SM_ERR)), + (SolidError::nlib("op", NlibCode::Convergence), Some(SM_ERR)), + (SolidError::invalid_input("op", "bad"), None), + ( + SolidError::NotFound { + operation: "op", + entity: EntityRef::Face(f), + }, + None, + ), + ( + SolidError::Degenerate { + operation: "op", + entity: None, + }, + None, + ), + ( + SolidError::NotConverged { + operation: "op", + iterations: 3, + }, + None, + ), + ( + SolidError::Unsupported { + operation: "op", + reason: "r", + }, + None, + ), + (SolidError::port_invariant("op", "owner"), None), + (SolidError::PreparationRequired { operation: "op" }, None), + (SolidError::unported("SmX::Y", "geom.x"), None), + ]; + for (e, status) in cases { + assert_eq!(e.sm_status(), status, "{e:?}"); + } + } + + #[test] + fn port_invariant_display_and_accessors() { + let e = + SolidError::port_invariant("topology::brep_cache", "edge owner is not in source B-rep"); + assert_eq!( + e.to_string(), + "topology::brep_cache: port invariant: edge owner is not in source B-rep" + ); + assert_eq!(e.operation(), "topology::brep_cache"); + assert_eq!(e.entity(), None); + assert!(!e.is_unported()); + // an ignored upstream status swallows it as it did the `InvalidInput` it was + assert_eq!(ignored::<()>(Err(e.clone())), Ok(None)); + assert_eq!( + SolidError::nl_ser("native")(e), + SolidError::sm_err("native") + ); + } + #[test] fn display_includes_operation_and_entity() { let e = SolidError::NotFound { diff --git a/crates/solidcore/src/geom/a_object.rs b/crates/solidcore/src/geom/a_object.rs index c1f83a88e8..595ced8915 100644 --- a/crates/solidcore/src/geom/a_object.rs +++ b/crates/solidcore/src/geom/a_object.rs @@ -1034,7 +1034,9 @@ pub fn get_or_create_object_cache( CacheMaker::AObject => Ok(cache_make_or_validate(cache_type, old)), CacheMaker::SagObject => match sag_cache_make_or_validate(cache_type, object_type, old) { // Like curve/surface factories, construction needs source geometry. - Err(e @ SolidError::InvalidInput { .. }) => return Err(e), + Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) => { + return Err(e) + } made => made, }, CacheMaker::Curve => match crate::curve::curve::p5::validate_curve_cache(cache_type, old) { diff --git a/crates/solidcore/src/heal/face_props.rs b/crates/solidcore/src/heal/face_props.rs index 1d4ca7460a..5d872ec83a 100644 --- a/crates/solidcore/src/heal/face_props.rs +++ b/crates/solidcore/src/heal/face_props.rs @@ -2339,9 +2339,10 @@ impl FaceProps { // (the status is only reported upstream; a handle type that cannot name the // loop bisector's objects is a limitation of the caller, not a status) match classify_result { - Err(e @ SolidError::InvalidInput { reason, .. }) - if reason == crate::query::face::p3::NO_CURVE_HANDLES => - { + Err( + e @ (SolidError::InvalidInput { reason, .. } + | SolidError::PortInvariant { reason, .. }), + ) if reason == crate::query::face::p3::NO_CURVE_HANDLES => { return Err(e); } r => Ok(ignored(r)?), diff --git a/crates/solidcore/src/intersect/curve_class/p4.rs b/crates/solidcore/src/intersect/curve_class/p4.rs index d4df1c8441..81ceb19c4b 100644 --- a/crates/solidcore/src/intersect/curve_class/p4.rs +++ b/crates/solidcore/src/intersect/curve_class/p4.rs @@ -178,7 +178,10 @@ pub struct LoopCrossings { const fn is_status(e: &SolidError) -> bool { !matches!( e, - SolidError::Unported { .. } | SolidError::InvalidInput { .. } | SolidError::NotFound { .. } + SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::NotFound { .. } ) } @@ -349,7 +352,7 @@ fn set_props_stage_2>( // an `InvalidInput` of `FaceProps` is an upstream null dereference (UB-131 for the // face pointer `SetProps_Gaps` left unset): it propagates instead of being ignored match props.set_props_stage2(k, b, f, face_index, HealerOpType::All) { - Err(e @ SolidError::InvalidInput { .. }) => Err(e), + Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) => Err(e), r => ignore_status(r), } } @@ -372,7 +375,7 @@ fn set_props_stage_2_mut>( )); }; match props.set_props_stage2_mut(k, b, f, face_index, HealerOpType::All) { - Err(e @ SolidError::InvalidInput { .. }) => Err(e), + Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) => Err(e), r => ignore_status(r), } } @@ -505,7 +508,11 @@ fn edgeuse_evaluate_binormal>( *binormal = r.binormal; Ok(()) } - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => { *point = Vec3::ZERO; Ok(()) diff --git a/crates/solidcore/src/intersect/curve_class/p6.rs b/crates/solidcore/src/intersect/curve_class/p6.rs index baf8c2bad6..8d61bdb9d5 100644 --- a/crates/solidcore/src/intersect/curve_class/p6.rs +++ b/crates/solidcore/src/intersect/curve_class/p6.rs @@ -1930,7 +1930,14 @@ fn vertex_faces(g: &impl ClassGeometry, v: O) -> Result) -> Result { match r { Ok(()) => Ok(true), - Err(e) if matches!(e, SolidError::InvalidInput { .. }) => Err(e), + Err(e) + if matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) => + { + Err(e) + } Err(e) => Ok(ignored(Err::<(), _>(e))?.is_some()), } } diff --git a/crates/solidcore/src/intersect/surface_drop_lib/p2.rs b/crates/solidcore/src/intersect/surface_drop_lib/p2.rs index 023b572cd1..33ae542c7a 100644 --- a/crates/solidcore/src/intersect/surface_drop_lib/p2.rs +++ b/crates/solidcore/src/intersect/surface_drop_lib/p2.rs @@ -342,7 +342,7 @@ fn find_degen_param( fn status_of(e: &SolidError) -> i32 { match e { SolidError::Upstream { code, .. } => *code, - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, _ => SM_ERR, } } diff --git a/crates/solidcore/src/intersect/surface_drop_lib/p3.rs b/crates/solidcore/src/intersect/surface_drop_lib/p3.rs index f03ad90af8..4f0f23157e 100644 --- a/crates/solidcore/src/intersect/surface_drop_lib/p3.rs +++ b/crates/solidcore/src/intersect/surface_drop_lib/p3.rs @@ -147,7 +147,7 @@ pub struct DropCurveOut { fn status_of(e: &SolidError) -> i32 { match e { SolidError::Upstream { code, .. } => *code, - SolidError::InvalidInput { .. } => SM_ERR_INVALID_INPUT, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => SM_ERR_INVALID_INPUT, SolidError::NotConverged { .. } => SM_ERR_NOT_CONVERGING, _ => SM_ERR, } diff --git a/crates/solidcore/src/intersect/surface_intersector/p4.rs b/crates/solidcore/src/intersect/surface_intersector/p4.rs index 789d8dfa01..6681d643c6 100644 --- a/crates/solidcore/src/intersect/surface_intersector/p4.rs +++ b/crates/solidcore/src/intersect/surface_intersector/p4.rs @@ -946,8 +946,11 @@ pub fn do_law_intersection_with<'s, V: IntersectorVirtuals<'s> + ?Sized>( for &id in &curve_pnts { // (status ignored, but linking a linked point is undefined upstream) - if let Err(e @ (SolidError::InvalidInput { .. } | SolidError::Unported { .. })) = - v.intersector_mut().add_point_to_curve(id) + if let Err( + e @ (SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::Unported { .. }), + ) = v.intersector_mut().add_point_to_curve(id) { return Err(e); } @@ -1512,8 +1515,11 @@ fn do_point_intersection_body<'s, V: IntersectorVirtuals<'s> + ?Sized>( } else { // the points between are through points (status ignored, but linking // a linked point is undefined upstream) - if let Err(e @ (SolidError::InvalidInput { .. } | SolidError::Unported { .. })) = - v.intersector_mut().add_through_point(pid) + if let Err( + e @ (SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::Unported { .. }), + ) = v.intersector_mut().add_through_point(pid) { return Err(e); } diff --git a/crates/solidcore/src/intersect/topology_solver/p1.rs b/crates/solidcore/src/intersect/topology_solver/p1.rs index 8b640e1c7e..505ca407dc 100644 --- a/crates/solidcore/src/intersect/topology_solver/p1.rs +++ b/crates/solidcore/src/intersect/topology_solver/p1.rs @@ -2220,6 +2220,7 @@ pub(super) fn face_point_classify( Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::PreparationRequired { .. }), ) => Err(e), // (status ignored, as upstream) diff --git a/crates/solidcore/src/nurbs/nurbs_crv.rs b/crates/solidcore/src/nurbs/nurbs_crv.rs index 5b19d872d6..8a091a0fac 100644 --- a/crates/solidcore/src/nurbs/nurbs_crv.rs +++ b/crates/solidcore/src/nurbs/nurbs_crv.rs @@ -1594,7 +1594,11 @@ pub fn crv_remove_knots(cur: &mut Curve, tol: f64) -> Result { fn span_maxima_result(r: Result) -> Result> { match r { Ok(sm) => Ok(Some(sm)), - Err(e @ (SolidError::InvalidInput { .. } | SolidError::Unported { .. })) => Err(e), + Err( + e @ (SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::Unported { .. }), + ) => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/offset/offset_geometry_creation.rs b/crates/solidcore/src/offset/offset_geometry_creation.rs index 8b9c9c70ca..2904407e61 100644 --- a/crates/solidcore/src/offset/offset_geometry_creation.rs +++ b/crates/solidcore/src/offset/offset_geometry_creation.rs @@ -1897,9 +1897,11 @@ impl OffsetGeometryCreation { operation: "geom::extent2d::Extent2d::intersect", .. }) => return Err(sm_err(OP_UPDATE)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => { - return Err(e) - } + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => return Err(e), Err(_) => return Err(sm_err(OP_UPDATE)), }; diff --git a/crates/solidcore/src/query/brep/ray/live.rs b/crates/solidcore/src/query/brep/ray/live.rs index 9899632ad1..5ff4127e42 100644 --- a/crates/solidcore/src/query/brep/ray/live.rs +++ b/crates/solidcore/src/query/brep/ray/live.rs @@ -527,6 +527,7 @@ impl<'a> BrepFaceServices<'a> { Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::PreparationRequired { .. }), ) => return Err(e), Err(_) if ignore_native_status => {} diff --git a/crates/solidcore/src/query/edge.rs b/crates/solidcore/src/query/edge.rs index 1040e4be92..8e709b9acd 100644 --- a/crates/solidcore/src/query/edge.rs +++ b/crates/solidcore/src/query/edge.rs @@ -482,11 +482,13 @@ fn evaluate_binormal_step_off( /// status (not a null dereference), which `SER` passes on unchanged. fn vec_status(r: Result, operation: &'static str) -> Result { r.map_err(|e| match e { - SolidError::InvalidInput { .. } => SolidError::Upstream { - operation, - code: SM_ERR_INVALID_INPUT, - entity: None, - }, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => { + SolidError::Upstream { + operation, + code: SM_ERR_INVALID_INPUT, + entity: None, + } + } e => e, }) } diff --git a/crates/solidcore/src/query/face/p2.rs b/crates/solidcore/src/query/face/p2.rs index edd91b18bd..778c3b643c 100644 --- a/crates/solidcore/src/query/face/p2.rs +++ b/crates/solidcore/src/query/face/p2.rs @@ -600,6 +600,7 @@ fn surface_cache_of_face( match e { SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. } => Err(e), // else - get or make SurfaceCache _ => Ok(FaceSurfaceCache { @@ -1213,6 +1214,7 @@ pub fn classify_param_on_faces( Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => Err(e), _ => Ok(pc.point_class()), diff --git a/crates/solidcore/src/query/poly.rs b/crates/solidcore/src/query/poly.rs index 062b3259fe..1d485142b7 100644 --- a/crates/solidcore/src/query/poly.rs +++ b/crates/solidcore/src/query/poly.rs @@ -1935,7 +1935,10 @@ impl PolyBrep { if let Some(v) = x.vertex { // the status is ignored upstream if let Err(err) = self.vertex_remove_poly_edge(v, e) { - if matches!(err, SolidError::InvalidInput { .. }) { + if matches!( + err, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) { return Err(err); } } diff --git a/crates/solidcore/src/surface/surf_of_extrusion/p2.rs b/crates/solidcore/src/surface/surf_of_extrusion/p2.rs index d8fcc22e43..e45c36dcc3 100644 --- a/crates/solidcore/src/surface/surf_of_extrusion/p2.rs +++ b/crates/solidcore/src/surface/surf_of_extrusion/p2.rs @@ -1073,7 +1073,15 @@ impl SurfOfExtrusion { Some(&mut out.curve_types), ) { Ok(r) => Ok(r.needs_more_intersections), - Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => Err(e), + Err(e) + if e.is_unported() + || matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) => + { + Err(e) + } Err(_) => Ok(false), } } diff --git a/crates/solidcore/src/surface/surface/p8.rs b/crates/solidcore/src/surface/surface/p8.rs index a8e2ca1e88..f507919e8a 100644 --- a/crates/solidcore/src/surface/surface/p8.rs +++ b/crates/solidcore/src/surface/surface/p8.rs @@ -1099,7 +1099,9 @@ impl Surface { Ok(blend) => blend, // too few intersection parameters: upstream reads and writes past the end of // its array here (UB-157), which the port does not reproduce - Err(e @ SolidError::InvalidInput { .. }) => return Err(e), + Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) => { + return Err(e) + } Err(e) if e.is_unported() => return Err(e), // a NULL blend surface Err(_) => return Err(SolidError::sm_err(OP_BLEND)), diff --git a/crates/solidcore/src/surface/volume/p2.rs b/crates/solidcore/src/surface/volume/p2.rs index 7c10b99b66..00e596293f 100644 --- a/crates/solidcore/src/surface/volume/p2.rs +++ b/crates/solidcore/src/surface/volume/p2.rs @@ -1534,9 +1534,10 @@ pub(crate) fn ignore_read(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), Err(e @ (SolidError::Unported { .. } | SolidError::Unsupported { .. })) => Err(e), - Err(e @ SolidError::InvalidInput { reason, .. }) if reason == NESTING_LIMIT_REASON => { - Err(e) - } + Err( + e + @ (SolidError::InvalidInput { reason, .. } | SolidError::PortInvariant { reason, .. }), + ) if reason == NESTING_LIMIT_REASON => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/topology/brep/p1.rs b/crates/solidcore/src/topology/brep/p1.rs index 49590e5c76..b92c9875b5 100644 --- a/crates/solidcore/src/topology/brep/p1.rs +++ b/crates/solidcore/src/topology/brep/p1.rs @@ -832,7 +832,9 @@ pub fn reset_infinite_region( SetRegionVoidType::NestedSolid => { // status ignored upstream; the port's null-dereference marker still propagates match set_region_is_void_flags_for_nested_solids(k, b) { - Err(e @ SolidError::InvalidInput { .. }) => return Err(e), + Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) => { + return Err(e) + } r => ignore_status(r)?, } } diff --git a/crates/solidcore/src/topology/brep/p10.rs b/crates/solidcore/src/topology/brep/p10.rs index 7e81df922b..295087d990 100644 --- a/crates/solidcore/src/topology/brep/p10.rs +++ b/crates/solidcore/src/topology/brep/p10.rs @@ -1650,9 +1650,11 @@ fn set_primary_edgeuses(b: &mut Brep, data: &BrepData, built: &Built) -> Result< // This takes care of next/last pointers. match edge::reset_primary_edgeuse(b, e, prim) { Err(err) if err.is_unported() => return Err(err), - Err(err @ (SolidError::InvalidInput { .. } | SolidError::NotFound { .. })) => { - return Err(err) - } + Err( + err @ (SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::NotFound { .. }), + ) => return Err(err), // the status is ignored upstream Ok(()) | Err(_) => {} } diff --git a/crates/solidcore/src/topology/brep/p2.rs b/crates/solidcore/src/topology/brep/p2.rs index f5760a2d6d..66d582bb8b 100644 --- a/crates/solidcore/src/topology/brep/p2.rs +++ b/crates/solidcore/src/topology/brep/p2.rs @@ -1926,7 +1926,7 @@ fn region_post_insert_shell(b: &mut Brep, r: RegionId, s: ShellId) -> Result<()> fn region_remove_shell(b: &mut Brep, s: ShellId) -> Result<()> { let r = shell_region(b, s)?.ok_or(null_deref("shell without region"))?; match shell::region_remove_shell(b, r, s) { - Err(SolidError::InvalidInput { .. }) | Ok(()) => Ok(()), + Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) | Ok(()) => Ok(()), Err(e) => Err(e), } } diff --git a/crates/solidcore/src/topology/brep/p3.rs b/crates/solidcore/src/topology/brep/p3.rs index 9776c3ccc8..bd82053dbb 100644 --- a/crates/solidcore/src/topology/brep/p3.rs +++ b/crates/solidcore/src/topology/brep/p3.rs @@ -167,6 +167,7 @@ fn ignore_soft(r: Result) -> Result<()> { Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => Err(e), Ok(_) | Err(_) => Ok(()), diff --git a/crates/solidcore/src/topology/brep/p6.rs b/crates/solidcore/src/topology/brep/p6.rs index f1daab03f8..bc1e4e72d1 100644 --- a/crates/solidcore/src/topology/brep/p6.rs +++ b/crates/solidcore/src/topology/brep/p6.rs @@ -473,7 +473,9 @@ fn delete_shell( // not on the region's list, `InvalidInput` in the shell port) is the native status. fn region_remove(brep: &mut Brep, region: RegionId, shell: ShellId) -> Result<()> { shell::region_remove_shell(brep, region, shell).map_err(|error| match error { - SolidError::InvalidInput { .. } => SolidError::sm_err(OP), + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => { + SolidError::sm_err(OP) + } other => other, }) } @@ -899,7 +901,8 @@ fn build_face( let shell_region = deref(eu::shell_region(brep, shell_vu)?)?; match shell::region_remove_shell(brep, shell_region, shell_vu) { // `SmOwningTopology::Remove`'s SM_ERR (not on the list) is ignored - Ok(()) | Err(SolidError::InvalidInput { .. }) => {} + Ok(()) + | Err(SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. }) => {} Err(error) => return Err(error), } delete_shell(k, brep, env, shell_vu)?; @@ -1673,6 +1676,7 @@ fn native(r: Result) -> Result> { Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => Err(e), Err(_) => Ok(None), @@ -2254,6 +2258,7 @@ fn ignore_status(r: Result<()>) -> Result<()> { Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => Err(e), _ => Ok(()), diff --git a/crates/solidcore/src/topology/brep/p8.rs b/crates/solidcore/src/topology/brep/p8.rs index 99ad5af25a..b7b7b2fc4c 100644 --- a/crates/solidcore/src/topology/brep/p8.rs +++ b/crates/solidcore/src/topology/brep/p8.rs @@ -166,7 +166,7 @@ fn as_sm_err(e: SolidError) -> SolidError { /// input upstream mishandles, e.g. `FindOuterLoops`' zero-area loop, UB-119) go through. fn plane_failed(e: SolidError) -> SolidError { match e { - SolidError::InvalidInput { .. } => e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => e, other => as_sm_err(other), } } diff --git a/crates/solidcore/src/topology/brep/p9.rs b/crates/solidcore/src/topology/brep/p9.rs index df09cbf9ef..5b8155e277 100644 --- a/crates/solidcore/src/topology/brep/p9.rs +++ b/crates/solidcore/src/topology/brep/p9.rs @@ -3165,7 +3165,7 @@ mod tests { entity: EntityRef::Edge(EdgeId::from_index(7)), }, SolidError::PreparationRequired { operation: OP }, - SolidError::invalid_input("topology::brep_cache", "edge owner is not in source B-rep"), + SolidError::port_invariant("topology::brep_cache", "edge owner is not in source B-rep"), ]; for e in internal { assert_eq!(ray_success(&Err(e.clone())), Err(e)); diff --git a/crates/solidcore/src/topology/brep_cache.rs b/crates/solidcore/src/topology/brep_cache.rs index 4b8d2f765e..a4fe95bab5 100644 --- a/crates/solidcore/src/topology/brep_cache.rs +++ b/crates/solidcore/src/topology/brep_cache.rs @@ -19,7 +19,8 @@ //! drops trees automatically. Exact B-rep lists remain explicit //! `topology.brep_p1` back-edges; arena allocation order is not list order. //! Rebuilding an initialized cache and resizing an -//! uninitialized cache return `InvalidInput` (upstream asserts). Ignored statuses +//! uninitialized cache return `PortInvariant` (upstream asserts; as do +//! the adapter's handle and owner checks, which upstream follows by pointer). Ignored statuses //! propagate Unported; an ordinary ignored box failure keeps the previous box, //! as upstream. No new recursion; spatial-tree traversal uses geom.tree's bounds. //! Face queries (`topology.face_p4`) remain explicit back-edges; the B-rep box calls @@ -43,7 +44,7 @@ const OP: &str = "topology::brep_cache"; /// the B-rep cache could not resolve under the caller's identities. Upstream addresses /// these objects by pointer, so no upstream status corresponds to it. pub(crate) fn is_identity_error(e: &SolidError) -> bool { - matches!(e, SolidError::InvalidInput { operation, .. } if *operation == OP) + matches!(e, SolidError::PortInvariant { operation, .. } if *operation == OP) } /// `SmBrepCache_TYPE`. pub const TYPE: i64 = 16400; @@ -167,7 +168,7 @@ impl BrepCache { || self.surfaces.is_some() || self.target_type != source.type_code() { - return Err(SolidError::invalid_input( + return Err(SolidError::port_invariant( OP, "cache already built or source type mismatch", )); @@ -306,7 +307,7 @@ impl BrepCache { owner_of: &dyn Fn(object::ObjectRef) -> Option, ) -> Result<()> { if self.vertices.is_none() || self.curves.is_none() || self.surfaces.is_none() { - return Err(SolidError::invalid_input(OP, "cache has not been built")); + return Err(SolidError::port_invariant(OP, "cache has not been built")); } let mut surface_union = Extent3d::new(); let mut curve_union = Extent3d::new(); @@ -528,13 +529,13 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn brep_cache(&self, object: CacheObject) -> Result<&BrepCache> { if object != CacheObject::Brep { - return Err(SolidError::invalid_input(OP, "expected B-rep handle")); + return Err(SolidError::port_invariant(OP, "expected B-rep handle")); } self.cache.ok_or(SolidError::null_pointer(OP)) } fn curve(&self, object: CacheObject) -> Result<&crate::curve::curve::Curve> { let CacheObject::Curve(e) = object else { - return Err(SolidError::invalid_input(OP, "expected curve handle")); + return Err(SolidError::port_invariant(OP, "expected curve handle")); }; self.brep .edge(e)? @@ -547,13 +548,13 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn vertex_point(&self, object: CacheObject) -> Result { let CacheObject::Vertex(v) = object else { - return Err(SolidError::invalid_input(OP, "expected vertex handle")); + return Err(SolidError::port_invariant(OP, "expected vertex handle")); }; Ok(self.brep.vertex(v)?.point) } fn vertex_tolerance(&self, object: CacheObject) -> Result { let CacheObject::Vertex(v) = object else { - return Err(SolidError::invalid_input(OP, "expected vertex handle")); + return Err(SolidError::port_invariant(OP, "expected vertex handle")); }; Ok(self.brep.vertex(v)?.tolerance) } @@ -571,7 +572,7 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn edge_curve(&self, object: CacheObject) -> Result> { let CacheObject::Edge(e) = object else { - return Err(SolidError::invalid_input(OP, "expected edge handle")); + return Err(SolidError::port_invariant(OP, "expected edge handle")); }; Ok(self .brep @@ -582,13 +583,13 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn edge_interval(&self, object: CacheObject) -> Result { let CacheObject::Edge(e) = object else { - return Err(SolidError::invalid_input(OP, "expected edge handle")); + return Err(SolidError::port_invariant(OP, "expected edge handle")); }; Ok(self.brep.edge(e)?.interval) } fn edge_tolerance(&self, object: CacheObject) -> Result { let CacheObject::Edge(e) = object else { - return Err(SolidError::invalid_input(OP, "expected edge handle")); + return Err(SolidError::port_invariant(OP, "expected edge handle")); }; Ok(self.brep.edge(e)?.tolerance) } @@ -600,7 +601,7 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn face_surface(&self, object: CacheObject) -> Result { let CacheObject::Face(f) = object else { - return Err(SolidError::invalid_input(OP, "expected face handle")); + return Err(SolidError::port_invariant(OP, "expected face handle")); }; self.brep .face(f)? @@ -611,7 +612,7 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn surface(&self, object: CacheObject) -> Result<&crate::surface::surface::Surface> { let CacheObject::Surface(f) = object else { - return Err(SolidError::invalid_input(OP, "expected surface handle")); + return Err(SolidError::port_invariant(OP, "expected surface handle")); }; self.brep .face(f)? @@ -621,13 +622,13 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre } fn face_uv_domain(&self, object: CacheObject) -> Result { let CacheObject::Face(f) = object else { - return Err(SolidError::invalid_input(OP, "expected face handle")); + return Err(SolidError::port_invariant(OP, "expected face handle")); }; Ok(self.brep.face(f)?.uv_domain) } fn face_tolerance(&self, object: CacheObject) -> Result { let CacheObject::Face(f) = object else { - return Err(SolidError::invalid_input(OP, "expected face handle")); + return Err(SolidError::port_invariant(OP, "expected face handle")); }; Ok(self.brep.face(f)?.tolerance) } @@ -660,12 +661,12 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre // geometry: the tolerance of its edge or face, else the system's CacheObject::Curve(_) => match self.curve_edge(object)? { Some(CacheObject::Edge(e)) => edge::tolerance(self.brep, e), - Some(_) => Err(SolidError::invalid_input(OP, "curve edge is not an edge")), + Some(_) => Err(SolidError::port_invariant(OP, "curve edge is not an edge")), None => Ok(system), }, CacheObject::Surface(_) => match self.surface_face(object)? { Some(CacheObject::Face(f)) => crate::topology::face::p2::tolerance(self.brep, f), - Some(_) => Err(SolidError::invalid_input(OP, "surface face is not a face")), + Some(_) => Err(SolidError::port_invariant(OP, "surface face is not a face")), None => Ok(system), }, // SmBrep: GetZoneTol3d(const SmBrep*) @@ -705,11 +706,11 @@ impl crate::intersect::topology_solver::p1::TopologyObjects for Bre ShapeMember::Edge((b, e)) => (b, CacheObject::Edge(e)), ShapeMember::Face((b, f)) => (b, CacheObject::Face(f)), ShapeMember::Other => { - return Err(SolidError::invalid_input(OP, "not a shape member")); + return Err(SolidError::port_invariant(OP, "not a shape member")); } }; if brep != self.brep_id { - return Err(SolidError::invalid_input( + return Err(SolidError::port_invariant( OP, "shape member of another B-rep", )); @@ -763,7 +764,7 @@ fn edge_id( .iter() .find(|(id, _)| keys(CacheObject::Edge(*id)) == owner) .map(|(id, _)| id) - .ok_or_else(|| SolidError::invalid_input(OP, "edge owner is not in source B-rep")) + .ok_or_else(|| SolidError::port_invariant(OP, "edge owner is not in source B-rep")) } fn face_id( b: &Brep, @@ -774,7 +775,7 @@ fn face_id( .iter() .find(|(id, _)| keys(CacheObject::Face(*id)) == owner) .map(|(id, _)| id) - .ok_or_else(|| SolidError::invalid_input(OP, "face owner is not in source B-rep")) + .ok_or_else(|| SolidError::port_invariant(OP, "face owner is not in source B-rep")) } #[cfg(test)] @@ -842,7 +843,7 @@ mod tests { objects.keys = &arena_identity; assert!(matches!( objects.curve_edge(CacheObject::Curve(e)), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::PortInvariant { .. }) )); } @@ -858,7 +859,7 @@ mod tests { let b = Brep::new(); assert!(matches!( cache.resize_trees(&k, &b, &[], &[], &[], &arena_identity, &|_| None), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::PortInvariant { .. }) )); // an edge without curve fails the build after the B-rep box, leaving no tree let mut open = Brep::new(); @@ -885,7 +886,7 @@ mod tests { let p = PolyBrep::new(&k, 1e-6); assert!(matches!( cache.build_trees(&k, CacheSource::PolyBrep(&p), |o| o, &arena_identity), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::PortInvariant { .. }) )); } @@ -897,7 +898,7 @@ mod tests { let mut cache = make_brep_cache(&k, CacheSource::PolyBrep(&p), &arena_identity).unwrap(); assert!(matches!( cache.build_trees(&k, CacheSource::PolyBrep(&p), |o| o, &arena_identity), - Err(SolidError::InvalidInput { .. }) + Err(SolidError::PortInvariant { .. }) )); let mut b = Brep::new(); let extra = b diff --git a/crates/solidcore/src/topology/edgeuse/p2.rs b/crates/solidcore/src/topology/edgeuse/p2.rs index b216354479..b95291dff9 100644 --- a/crates/solidcore/src/topology/edgeuse/p2.rs +++ b/crates/solidcore/src/topology/edgeuse/p2.rs @@ -147,7 +147,10 @@ fn edge_set_tolerance(b: &mut Brep, eu: EdgeuseId, tolerance: f64) -> Result<()> fn ser_as_true(e: &SolidError) -> bool { !matches!( e, - SolidError::Unported { .. } | SolidError::InvalidInput { .. } | SolidError::NotFound { .. } + SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::NotFound { .. } ) } @@ -176,6 +179,7 @@ pub(crate) fn binormal_ignoring_status( Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => Err(e), Err(_) => Ok(BinormalEval { diff --git a/crates/solidcore/src/topology/edgeuse/p3.rs b/crates/solidcore/src/topology/edgeuse/p3.rs index 1d918050b8..e13ce49195 100644 --- a/crates/solidcore/src/topology/edgeuse/p3.rs +++ b/crates/solidcore/src/topology/edgeuse/p3.rs @@ -128,11 +128,13 @@ fn null(reason: &'static str) -> SolidError { /// dereference. fn vec_status(r: Result) -> Result { r.map_err(|e| match e { - SolidError::InvalidInput { .. } => SolidError::Upstream { - operation: OP, - code: 1007, // SM_ERR_INVALID_INPUT - entity: None, - }, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } => { + SolidError::Upstream { + operation: OP, + code: 1007, // SM_ERR_INVALID_INPUT + entity: None, + } + } e => e, }) } @@ -1615,6 +1617,7 @@ pub fn get_or_create_uv_trim_curve( Err( e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } | SolidError::NotFound { .. }), ) => return Err(e), Err(e) => { diff --git a/crates/solidcore/src/topology/face/p1.rs b/crates/solidcore/src/topology/face/p1.rs index 855fe0a128..fa3229ddb3 100644 --- a/crates/solidcore/src/topology/face/p1.rs +++ b/crates/solidcore/src/topology/face/p1.rs @@ -341,7 +341,15 @@ fn has_near_misses( ) -> Result { match c.has_near_misses(k, geometry, false) { Ok(v) => Ok(v), - Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => Err(e), + Err(e) + if e.is_unported() + || matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) => + { + Err(e) + } Err(_) => Ok(false), } } diff --git a/crates/solidcore/src/topology/face/p4.rs b/crates/solidcore/src/topology/face/p4.rs index 2d9e0bb3c6..2269537d6a 100644 --- a/crates/solidcore/src/topology/face/p4.rs +++ b/crates/solidcore/src/topology/face/p4.rs @@ -172,7 +172,10 @@ fn null(reason: &'static str) -> SolidError { const fn must_propagate(e: &SolidError) -> bool { matches!( e, - SolidError::Unported { .. } | SolidError::InvalidInput { .. } | SolidError::NotFound { .. } + SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. } + | SolidError::NotFound { .. } ) } diff --git a/crates/solidcore/src/topology/proto_topology/p1/assembly.rs b/crates/solidcore/src/topology/proto_topology/p1/assembly.rs index 941d24d0ef..6eb38645a8 100644 --- a/crates/solidcore/src/topology/proto_topology/p1/assembly.rs +++ b/crates/solidcore/src/topology/proto_topology/p1/assembly.rs @@ -159,7 +159,10 @@ impl Assembly { let status = list.remove(this, records, instance); store_list(records, this, list)?; match status { - Err(e @ crate::error::SolidError::InvalidInput { .. }) => Err(e), + Err( + e @ (crate::error::SolidError::InvalidInput { .. } + | crate::error::SolidError::PortInvariant { .. }), + ) => Err(e), Ok(()) | Err(_) => Ok(()), } } @@ -180,8 +183,10 @@ impl Assembly { let instances = Self::assembly_instances(records, this)?; let mut list = list_of(records, this)?; for i in instances { - if let Err(e @ crate::error::SolidError::InvalidInput { .. }) = - list.remove(this, records, i) + if let Err( + e @ (crate::error::SolidError::InvalidInput { .. } + | crate::error::SolidError::PortInvariant { .. }), + ) = list.remove(this, records, i) { return Err(e); } diff --git a/crates/solidcore/src/topology/proto_topology/p1/owning_topology.rs b/crates/solidcore/src/topology/proto_topology/p1/owning_topology.rs index 1a4ece9f9e..aad0e248c2 100644 --- a/crates/solidcore/src/topology/proto_topology/p1/owning_topology.rs +++ b/crates/solidcore/src/topology/proto_topology/p1/owning_topology.rs @@ -510,7 +510,9 @@ pub fn destroy_topology(records: &mut R, this: Object return Ok(()); }; let mut list = records.owning(owner).ok_or(broken_list(OP))?; - if let Err(e @ SolidError::InvalidInput { .. }) = list.remove(owner, records, this) { + if let Err(e @ (SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. })) = + list.remove(owner, records, this) + { return Err(e); } records.set_owning(owner, list).ok_or(broken_list(OP))?; diff --git a/crates/solidcore/src/topology/proto_topology/p1/proto.rs b/crates/solidcore/src/topology/proto_topology/p1/proto.rs index 794a01a04d..d3f38a54dc 100644 --- a/crates/solidcore/src/topology/proto_topology/p1/proto.rs +++ b/crates/solidcore/src/topology/proto_topology/p1/proto.rs @@ -293,7 +293,12 @@ fn curve_of(geometry: &impl ClassGeometry, o: Option) -> Result<& /// A status upstream ignores, except the errors that cannot be ignored here: unported /// callees and undefined behaviour upstream. fn ignore_soft(r: Result) -> Result<()> { - if let Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) = r { + if let Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) = r + { return Err(e); } Ok(()) @@ -789,7 +794,11 @@ pub fn find_ed_on_degen_face( fn degen_face_choice(r: Result) -> Result { match r { Ok(n) => Ok(n), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(0), } } @@ -3564,9 +3573,11 @@ impl ProtoTopologyManager { let split_pt = match self.proto_edge_evaluate(k, geometry, orig_pe, split_param, true, false) { Ok((Some(p), _)) => p, - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => { - return Err(e) - } + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => return Err(e), _ => Vec3::UNDEF, }; diff --git a/crates/solidcore/src/topology/proto_topology/p2.rs b/crates/solidcore/src/topology/proto_topology/p2.rs index c4c9e22511..9407f82982 100644 --- a/crates/solidcore/src/topology/proto_topology/p2.rs +++ b/crates/solidcore/src/topology/proto_topology/p2.rs @@ -356,7 +356,11 @@ const fn dangling(reason: &'static str) -> SolidError { fn ignore_soft(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(None), } } @@ -2016,7 +2020,13 @@ impl ProtoTopologyManager { // definition to both edges' curves. let mid_pt = match d.evaluate_mid(k, brep, true, false) { Ok((Some(p), _)) => p, - Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => { + Err(e) + if e.is_unported() + || matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) => + { return Err(e) } _ => Vec3::UNDEF, diff --git a/crates/solidcore/src/topology/proto_topology/p3.rs b/crates/solidcore/src/topology/proto_topology/p3.rs index 7325513ed5..dc6a5b7cf9 100644 --- a/crates/solidcore/src/topology/proto_topology/p3.rs +++ b/crates/solidcore/src/topology/proto_topology/p3.rs @@ -129,7 +129,11 @@ const fn dangling(reason: &'static str) -> SolidError { fn ignore_soft(r: Result) -> Result> { match r { Ok(v) => Ok(Some(v)), - Err(e @ (SolidError::Unported { .. } | SolidError::InvalidInput { .. })) => Err(e), + Err( + e @ (SolidError::Unported { .. } + | SolidError::InvalidInput { .. } + | SolidError::PortInvariant { .. }), + ) => Err(e), Err(_) => Ok(None), } } diff --git a/crates/solidcore/src/topology/trimming_tools.rs b/crates/solidcore/src/topology/trimming_tools.rs index 2c4310ea39..519bb7cc3f 100644 --- a/crates/solidcore/src/topology/trimming_tools.rs +++ b/crates/solidcore/src/topology/trimming_tools.rs @@ -2543,7 +2543,15 @@ pub fn mirror_curve( pub fn is_iso_curve_at(curve: &Curve, side: SurfParamType, low: f64, tol_2d: f64) -> Result { let canon = match bspline_of(curve).and_then(|c| c.canonical()) { Ok(c) => c, - Err(e) if e.is_unported() || matches!(e, SolidError::InvalidInput { .. }) => return Err(e), + Err(e) + if e.is_unported() + || matches!( + e, + SolidError::InvalidInput { .. } | SolidError::PortInvariant { .. } + ) => + { + return Err(e) + } Err(_) => return Ok(true), }; let coord = usize::from(side != SurfParamType::U); diff --git a/crates/solidcore/tests/issue_1452_sm_status.rs b/crates/solidcore/tests/issue_1452_sm_status.rs new file mode 100644 index 0000000000..d83aa75678 --- /dev/null +++ b/crates/solidcore/tests/issue_1452_sm_status.rs @@ -0,0 +1,84 @@ +//! #1452: `SolidError::sm_status` tells an upstream `SmStatus` from a port-side +//! invariant failure. The #1440 misuse (a caller-keyed copy queried under its +//! naming-only identities) fails with `PortInvariant`, which stands for no upstream +//! status; `SmApiBrepCopy` of a null B-rep returns upstream `SM_ERR_INVALID_INPUT`. + +use solidcore::error::SM_ERR_INVALID_INPUT; +use solidcore::geom::attribute::ObjectKey; +use solidcore::geom::object::{ObjectRef, Shape}; +use solidcore::kernel::{Kernel, KernelOptions}; +use solidcore::math::Vec3; +use solidcore::primitive::api_primitives::create_box; +use solidcore::query::api_queries::face_closest_point_in_shape; +use solidcore::query::brep::{BrepIdentity, LiveBrepObjects}; +use solidcore::topology::brep::p1::faces; +use solidcore::topology::brep::{p2, p3}; +use solidcore::{Brep, BrepId, EntityRef, SolidError}; + +/// A caller naming: the notification layout shifted by `base`. +fn named(e: EntityRef, base: u64) -> ObjectRef { + let (type_code, kind, index) = match e { + EntityRef::Brep(x) => (16011, 0u64, x.index()), + EntityRef::Region(x) => (16012, 1, x.index()), + EntityRef::Shell(x) => (16013, 2, x.index()), + EntityRef::Faceuse(x) => (16022, 3, x.index()), + EntityRef::Face(x) => (16002, 4, x.index()), + EntityRef::Loopuse(x) => (16004, 5, x.index()), + EntityRef::Loop(x) => (16003, 6, x.index()), + EntityRef::Edgeuse(x) => (16005, 7, x.index()), + EntityRef::Edge(x) => (16016, 8, x.index()), + EntityRef::Vertexuse(x) => (16006, 9, x.index()), + EntityRef::Vertex(x) => (16021, 10, x.index()), + }; + ObjectRef { + type_code, + key: ObjectKey(base + 1 + (kind << 32) + u64::from(index)), + } +} + +const ONE: BrepId = BrepId::from_index(0); + +fn caller_keyed_copy(k: &mut Kernel, b: &Brep) -> solidcore::Result { + let mut state = p2::ArenaNotifyState::new(&Brep::new()); + let mut env = state.env(None); + let key_of = |e| named(e, 100_000_000); + env.key_of = &key_of; + p3::api_brep_copy(k, &mut env, Some(b), &|e| named(e, 0)) +} + +#[test] +fn identity_misuse_is_a_port_invariant_without_status() { + let mut k = Kernel::new(&KernelOptions::default()); + let b = create_box(&mut k, Vec3::new(0.0, 0.0, 0.0), 30.0, 20.0, 10.0).unwrap(); + let mut w = caller_keyed_copy(&mut k, &b).unwrap(); + // the copy's naming alone (arena keys) does not name its caller-keyed owners + let identity = BrepIdentity::of_naming_with_id(ONE, &w); + let p = Vec3::new(15.0, 10.0, 20.0); + let f = faces(&w, None).unwrap()[0]; + let shape = Shape::new(&mut k, &(ONE, &w), &[], &[(ONE, f)], &[], &[]).unwrap(); + let objects = LiveBrepObjects::new(&mut w, &identity, None).unwrap(); + let e = face_closest_point_in_shape(&k, &shape, &objects, (ONE, f), p).unwrap_err(); + assert!( + matches!( + e, + SolidError::PortInvariant { + operation: "topology::brep_cache", + .. + } + ), + "{e:?}" + ); + assert_eq!(e.sm_status(), None); +} + +#[test] +fn upstream_invalid_input_has_its_status() { + let mut k = Kernel::new(&KernelOptions::default()); + let mut state = p2::ArenaNotifyState::new(&Brep::new()); + let mut env = state.env(None); + // SmApiBrepCopy(NULL): SM_ERR_INVALID_INPUT + let e = p3::api_brep_copy(&mut k, &mut env, None, &|e| named(e, 0)).unwrap_err(); + assert!(matches!(e, SolidError::Upstream { .. }), "{e:?}"); + assert_eq!(e.sm_status(), Some(SM_ERR_INVALID_INPUT)); + assert_eq!(e.sm_status(), Some(1007)); +}