Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add apply_dynamic to FuncDecl #330

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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)
    }
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant