From: Mark Date: Wed, 29 Nov 2023 17:51:55 +0000 (-0700) Subject: fix overeager detection of (->)/2 in if position of (;)/2 (#2183) X-Git-Tag: v0.9.4~94 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=de452bb2c2051da0774c5e1504b40305167e84bc;p=scryer-prolog.git fix overeager detection of (->)/2 in if position of (;)/2 (#2183) --- 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 };