Skip to content

Commit 03d3d3d

Browse files
authored
Merge pull request #320 from ichiban/fix-succ-vars
fix variable handling in Succ()
2 parents 76ad1bf + 5cc57f1 commit 03d3d3d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

engine/builtin.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2817,9 +2817,9 @@ func nth(vm *VM, base Integer, n, list, elem Term, k Cont, env *Env) *Promise {
28172817

28182818
// Succ succeeds if s is the successor of non-negative integer x.
28192819
func Succ(vm *VM, x, s Term, k Cont, env *Env) *Promise {
2820-
switch x := x.(type) {
2820+
switch x := env.Resolve(x).(type) {
28212821
case Variable:
2822-
switch s := s.(type) {
2822+
switch s := env.Resolve(s).(type) {
28232823
case Variable:
28242824
return Error(InstantiationError(env))
28252825
case Integer:
@@ -2848,7 +2848,7 @@ func Succ(vm *VM, x, s Term, k Cont, env *Env) *Promise {
28482848
return Error(err)
28492849
}
28502850

2851-
switch s := s.(type) {
2851+
switch s := env.Resolve(s).(type) {
28522852
case Variable:
28532853
return Unify(vm, s, r, k, env)
28542854
case Integer:

0 commit comments

Comments
 (0)