noir
noir copied to clipboard
chore: proptest for `canonicalize` on infix type expressions
Description
Problem*
Resolves https://github.com/noir-lang/noir/issues/6263
Summary*
This test found the following case where instantiating with or without a call to canonicalize
beforehand gives different results:
thread 'tests::arithmetic_generics::instantiate_before_or_after_canonicalize' panicked at compiler/noirc_frontend/src/tests/arithmetic_generics.rs:184:1:
Test failed: assertion failed: matches!(infix, Type :: Constant(..)) at compiler/noirc_frontend/src/tests/arithmetic_generics.rs:202.
minimal failing input: infix_type_bindings = (
(((0: numeric u1) * Numeric(Shared(RefCell { value: Unbound('0, Numeric(u1)) }): u1)) / (Numeric(Shared(RefCell { value: Unbound('0, Numeric(u1)) }): u1) % Numeric(Shared(RefCell { value: Unbound('0, Numeric(u1)) }): u1))),
u1,
[
(
'0,
(0: numeric u1),
),
],
)
Other failing cases:
Test failed: assertion failed: matches!(infix, Type :: Constant(..)) at compiler/noirc_frontend/src/tests/arithmetic_generics.rs:209.
minimal failing input: infix_type_bindings = (
(Numeric(Shared(RefCell { value: Unbound('0, Numeric(Field)) }): Field) - Numeric(Shared(RefCell { value: Unbound('0, Numeric(Field)) }): Field)),
Field,
[
(
'0,
(4823496818409495870346222387225912109731308268627179654751344972009805969137: numeric Field),
),
],
)
Test failed: assertion failed: matches!(infix, Type :: Constant(..)) at compiler/noirc_frontend/src/tests/arithmetic_generics.rs:209.
minimal failing input: infix_type_bindings = (
(Numeric(Shared(RefCell { value: Unbound('0, Numeric(u64)) }): u64) + (Numeric(Shared(RefCell { value: Unbound('0, Numeric(u64)) }): u64) + (7125011455366710072: numeric u64))),
u64,
[
(
'0,
(0: numeric u64),
),
(
'1,
(5504595553084717865: numeric u64),
),
(
'2,
(6040525908041204353: numeric u64),
),
(
'3,
(5583016661666702983: numeric u64),
),
(
'4,
(15706909516301894993: numeric u64),
),
],
)
Additional Context
Documentation*
Check one:
- [ ] No documentation needed.
- [ ] Documentation included in this PR.
- [ ] [For Experimental Features] Documentation to be submitted in a separate PR.
PR Checklist*
- [ ] I have tested the changes locally.
- [ ] I have formatted the changes with Prettier and/or
cargo fmt
on default settings.