Skip to content

Commit

Permalink
Merge pull request #6 from ApolloLiZhaoyu/master
Browse files Browse the repository at this point in the history
Fix a small bug when there are shelved_goals and given_up_goals.
  • Loading branch information
Kaiyu Yang authored Aug 7, 2020
2 parents d5e5f42 + 7258f59 commit 85d3c85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eval_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def step(self, command):
self.num_tactics_left -= 1
command = 'timeout %d (%s).' % (time_left, command[:-1])
responses, _ = self.serapi.execute(command)
self.serapi.pull() # delete the saved state if no error
states_cnt = self.serapi.pull() # delete the saved state if no error
except CoqExn as ex:
self.serapi.pop() # restore the state
return self.feedback('ERROR', error=ex)
Expand All @@ -97,7 +97,7 @@ def step(self, command):
self.success = True
return self.feedback('SUCCESS')
elif shelved_goals + given_up_goals != []:
self.serapi.pop()
self.serapi.pop_n(states_cnt)
return self.feedback('ERROR', error=(shelved_goals, given_up_goals))
else:
return self.feedback('PROVING', fg_goals=fg_goals, bg_goals=bg_goals,
Expand Down
8 changes: 8 additions & 0 deletions serapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,13 +358,21 @@ def pull(self):
'remove a checkpoint created by push'
states = self.states_stack.pop()
self.states_stack[-1].extend(states)
return len(states)


def pop(self):
'rollback to a checkpoint created by push'
self.cancel(self.states_stack.pop())


def pop_n(self, cnt):
states = []
for i in range(cnt):
states.append(self.states_stack[-1].pop())
self.cancel(states)


def clean(self):
self.proc.sendeof()
self.proc.wait()
Expand Down

0 comments on commit 85d3c85

Please sign in to comment.