Skip to content

Conversation

@cvick32
Copy link

@cvick32 cvick32 commented Dec 11, 2024

I was running into trouble calling func_decl.apply() with variables of type Dynamic. I tried to iterate over the arguments to get a &[&dyn Ast] by matching up the domain sorts with the arguments, but I felt like having an apply_dynamic function on FuncDecl made more sense.

Let me know if there's an easier way to build &dyn Ast from a Dynamic or if this is redundant/unnecessary.

Here's an example of how I used it:

pub struct FunctionDefinition<'ctx> {
    z3_function: FuncDecl<'ctx>,
    domain: Vec<z3::Sort<'ctx>>,
}
impl<'ctx> FunctionDefinition<'ctx> {
    fn apply(&self, argument_values: Vec<Dynamic<'ctx>>) -> Dynamic<'_> {
        assert!(self.domain.len() == argument_values.len());
        let ref_args = argument_values.iter().collect::<Vec<_>>();
        self.z3_function.apply_dynamic(&ref_args)
    }
}

@toolCHAINZ toolCHAINZ added the enhancement New feature or request label Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants