test: Cut not_equal

This commit is contained in:
Tibo De Peuter 2025-04-15 16:40:52 +02:00
parent 229a8bbc3c
commit 2fcab52f65
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
7 changed files with 75 additions and 18 deletions

View file

@ -4,7 +4,7 @@ import prolog.Answers
import prolog.Substitutions
import prolog.ast.terms.Functor
import prolog.ast.terms.Goal
import prolog.exceptions.AppliedCut
import prolog.flags.AppliedCut
/**
* Collection of [Clause]s with the same [Functor].
@ -62,8 +62,10 @@ class Predicate : Resolvent {
},
onFailure = {
if (it is AppliedCut) {
// If it's a cut, yield the result with the left substitutions
yield(Result.failure(AppliedCut(it.subs)))
if (it.subs != null) {
// If it's a cut, yield the result with the left substitutions
yield(Result.success(it.subs))
}
return@sequence
} else {
yield(Result.failure(it))