3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-22 16:27:37 +00:00

Fix Go bindings reference counting for Z3_ast_vector objects

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-02-16 21:48:49 +00:00
parent 1e77b150a8
commit ea1f5a333a
3 changed files with 30 additions and 30 deletions

View file

@ -134,23 +134,13 @@ func (s *Solver) NumScopes() uint {
// Assertions returns the assertions in the solver.
func (s *Solver) Assertions() []*Expr {
vec := C.Z3_solver_get_assertions(s.ctx.ptr, s.ptr)
size := uint(C.Z3_ast_vector_size(s.ctx.ptr, vec))
result := make([]*Expr, size)
for i := uint(0); i < size; i++ {
result[i] = newExpr(s.ctx, C.Z3_ast_vector_get(s.ctx.ptr, vec, C.uint(i)))
}
return result
return astVectorToExprs(s.ctx, vec)
}
// UnsatCore returns the unsat core if the constraints are unsatisfiable.
func (s *Solver) UnsatCore() []*Expr {
vec := C.Z3_solver_get_unsat_core(s.ctx.ptr, s.ptr)
size := uint(C.Z3_ast_vector_size(s.ctx.ptr, vec))
result := make([]*Expr, size)
for i := uint(0); i < size; i++ {
result[i] = newExpr(s.ctx, C.Z3_ast_vector_get(s.ctx.ptr, vec, C.uint(i)))
}
return result
return astVectorToExprs(s.ctx, vec)
}
// ReasonUnknown returns the reason why the result is unknown.