6041 def update_field(self, field_accessor, new_value):
6042 """Return a new datatype expression with the specified field updated.
6043
6044 Args:
6045 field_accessor: The accessor function declaration for the field to update
6046 new_value: The new value for the field
6047
6048 Returns:
6049 A new datatype expression with the field updated, other fields unchanged
6050
6051 Example:
6052 >>> Person = Datatype('Person')
6053 >>> Person.declare('person', ('name', StringSort()), ('age', IntSort()))
6054 >>> Person = Person.create()
6055 >>> person_age = Person.accessor(0, 1) # age accessor
6056 >>> p = Const('p', Person)
6057 >>> p2 = p.update_field(person_age, IntVal(30))
6058 """
6059 if z3_debug():
6060 _z3_assert(is_func_decl(field_accessor), "Z3 function declaration expected")
6061 _z3_assert(is_expr(new_value), "Z3 expression expected")
6062 return _to_expr_ref(
6064 self.ctx
6065 )
6066
Z3_ast Z3_API Z3_datatype_update_field(Z3_context c, Z3_func_decl field_access, Z3_ast t, Z3_ast value)
Update record field with a value.