Skip to content

Commit

Permalink
Merge pull request ichiban#320 from ichiban/fix-succ-vars
Browse files Browse the repository at this point in the history
fix variable handling in Succ()
  • Loading branch information
ichiban authored Jun 13, 2024
2 parents 76ad1bf + 5cc57f1 commit 03d3d3d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions engine/builtin.go
Original file line number Diff line number Diff line change
Expand Up @@ -2817,9 +2817,9 @@ func nth(vm *VM, base Integer, n, list, elem Term, k Cont, env *Env) *Promise {

// Succ succeeds if s is the successor of non-negative integer x.
func Succ(vm *VM, x, s Term, k Cont, env *Env) *Promise {
switch x := x.(type) {
switch x := env.Resolve(x).(type) {
case Variable:
switch s := s.(type) {
switch s := env.Resolve(s).(type) {
case Variable:
return Error(InstantiationError(env))
case Integer:
Expand Down Expand Up @@ -2848,7 +2848,7 @@ func Succ(vm *VM, x, s Term, k Cont, env *Env) *Promise {
return Error(err)
}

switch s := s.(type) {
switch s := env.Resolve(s).(type) {
case Variable:
return Unify(vm, s, r, k, env)
case Integer:
Expand Down

0 comments on commit 03d3d3d

Please sign in to comment.