From de452bb2c2051da0774c5e1504b40305167e84bc Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 29 Nov 2023 10:51:55 -0700 Subject: [PATCH] fix overeager detection of (->)/2 in if position of (;)/2 (#2183) --- src/machine/disjuncts.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/machine/disjuncts.rs b/src/machine/disjuncts.rs index e0712265..d3fc6a88 100644 --- a/src/machine/disjuncts.rs +++ b/src/machine/disjuncts.rs @@ -663,12 +663,16 @@ impl VariableClassifier { state_stack.last(), Some(TraversalState::RemoveBranchNum) ) { - // check if the second-to-last element is a regular BuildDisjunct, as we don't - // want to add GetPrevLevel in case of a TrustMe. - matches!( - state_stack.iter().rev().nth(1), - Some(TraversalState::BuildDisjunct(..)) - ) + // check if the second-to-last element + // is a regular BuildDisjunct, as we + // don't want to add GetPrevLevel in + // case of a TrustMe. + match state_stack.iter().rev().nth(1) { + Some(&TraversalState::BuildDisjunct(preceding_len)) => { + preceding_len + 1 == build_stack.len() + } + _ => false, + } } else { false }; -- 2.54.0