fix: unify infix expressions by isolating unbound type variables#8796
Merged
fix: unify infix expressions by isolating unbound type variables#8796
Conversation
jfecher
approved these changes
Jun 4, 2025
github-merge-queue bot
pushed a commit
to AztecProtocol/aztec-packages
that referenced
this pull request
Jun 6, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix: type unification tests, and try moving constants to the other side (noir-lang/noir#8807) fix!: disallow casting numeric to bool (noir-lang/noir#8703) fix: delay associated constants resolution (noir-lang/noir#8744) fix: right shift overflow to 0 (noir-lang/noir#8772) fix: use value predicated by range checks (noir-lang/noir#8778) fix: unify infix expressions by isolating unbound type variables (noir-lang/noir#8796) feat: use `asm` feature flag in arkworks (noir-lang/noir#8792) chore: add a failing test for #8780 (noir-lang/noir#8785) chore: Adjust the frequency of 'for' statements in ACIR fuzz generation (noir-lang/noir#8788) fix: Merge `replacement_type` and `is_function_type` in `defunctionalization` (noir-lang/noir#8784) chore(fuzz): Remove unreachable functions in the AST fuzzer (noir-lang/noir#8782) chore(docs): Copy attribute docs into versioned docs (noir-lang/noir#8777) fix(licm): Preserve semantic ordering of side-effectual instructions when hoisting (noir-lang/noir#8724) fix: Create SSA interpreter arguments from scratch for each invocation (noir-lang/noir#8762) chore: mark sha512 as non-critical (noir-lang/noir#8776) fix!: disallow specifying associated items via generics (noir-lang/noir#8756) fix: stop inserting instructions after break and continue (noir-lang/noir#8712) fix: Fix comptime casts of negative integer to field (noir-lang/noir#8696) chore(SSA): restrict `shr` and `shl` right-hand side to u8 (noir-lang/noir#8753) chore: bump some JS packages (noir-lang/noir#8771) chore: document `allow(dead_code)` and reorganize attributes (noir-lang/noir#8766) fix: Add missing cases for finding function values in `find_functions_as_values` (noir-lang/noir#8738) fix: correct bitsize in signed division (noir-lang/noir#8733) chore: remove noir-lang/noir_rsa from external libraries (noir-lang/noir#8752) chore: bump external pinned commits (noir-lang/noir#8747) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
danielntmd
pushed a commit
to danielntmd/aztec-packages
that referenced
this pull request
Jul 16, 2025
Automated pull of nightly from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE fix: type unification tests, and try moving constants to the other side (noir-lang/noir#8807) fix!: disallow casting numeric to bool (noir-lang/noir#8703) fix: delay associated constants resolution (noir-lang/noir#8744) fix: right shift overflow to 0 (noir-lang/noir#8772) fix: use value predicated by range checks (noir-lang/noir#8778) fix: unify infix expressions by isolating unbound type variables (noir-lang/noir#8796) feat: use `asm` feature flag in arkworks (noir-lang/noir#8792) chore: add a failing test for AztecProtocol#8780 (noir-lang/noir#8785) chore: Adjust the frequency of 'for' statements in ACIR fuzz generation (noir-lang/noir#8788) fix: Merge `replacement_type` and `is_function_type` in `defunctionalization` (noir-lang/noir#8784) chore(fuzz): Remove unreachable functions in the AST fuzzer (noir-lang/noir#8782) chore(docs): Copy attribute docs into versioned docs (noir-lang/noir#8777) fix(licm): Preserve semantic ordering of side-effectual instructions when hoisting (noir-lang/noir#8724) fix: Create SSA interpreter arguments from scratch for each invocation (noir-lang/noir#8762) chore: mark sha512 as non-critical (noir-lang/noir#8776) fix!: disallow specifying associated items via generics (noir-lang/noir#8756) fix: stop inserting instructions after break and continue (noir-lang/noir#8712) fix: Fix comptime casts of negative integer to field (noir-lang/noir#8696) chore(SSA): restrict `shr` and `shl` right-hand side to u8 (noir-lang/noir#8753) chore: bump some JS packages (noir-lang/noir#8771) chore: document `allow(dead_code)` and reorganize attributes (noir-lang/noir#8766) fix: Add missing cases for finding function values in `find_functions_as_values` (noir-lang/noir#8738) fix: correct bitsize in signed division (noir-lang/noir#8733) chore: remove noir-lang/noir_rsa from external libraries (noir-lang/noir#8752) chore: bump external pinned commits (noir-lang/noir#8747) END_COMMIT_OVERRIDE --------- Co-authored-by: AztecBot <tech@aztecprotocol.com> Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
Resolves #8780
Summary
The explanation of why this works is a bit tricky, but here it is:
sort_commutative) types are sortedType::TypeVariableeventually holds a type variable ID, and that's how these types are sortedTypeBindings, these might affect the result ofsort_commutativeA + B = 3 - C, and that doesn't unifyHuge thanks to @jfecher for helping me debug this. While debugging, we noticed that even though
A + B = 3 - Cdidn't unify, it could. The "solution" is to say thatA = 3 - C - Bor thatB = 3 - C - A, and that's what this PR does. Now that these unify, it doesn't matter anymore whether we end up with one type or another usingsort_commutative, because in both cases we'll be able to unify them.@jfecher Feel free to improve the above explanation 😅
Additional Context
Documentation
Check one:
PR Checklist
cargo fmton default settings.