noir icon indicating copy to clipboard operation
noir copied to clipboard

Investigate whether kind check can be removed from `evaluate_to_field_element`

Open michaeljklein opened this issue 4 months ago • 0 comments

Problem

evaluate_to_field_element (from https://github.com/noir-lang/noir/pull/6137) currently checks the kind of its input:

        if let Some((binding, binding_kind)) = self.get_inner_type_variable() {
            if let TypeBinding::Bound(binding) = &*binding.borrow() {
                if kind.unifies(&binding_kind) {
                    return binding.evaluate_to_field_element(&binding_kind);
                }
            }
        }

        match self.canonicalize() {
            Type::Constant(x, constant_kind) => {
                if kind.unifies(&constant_kind) {
...

Happy Case

After we've completed the rest of the issues related to Kind size checks, investigate whether we can remove the kind.unifies(..) checks from evaluate_to_field_element.

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

Nice-to-have

Blocker Context

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

michaeljklein avatar Oct 09 '24 15:10 michaeljklein