noir-lang / noir

Noir is a domain specific language for zero knowledge proofs
https://noir-lang.org
Apache License 2.0
821 stars 177 forks source link

fix: Avoid panic in type system #5332

Closed jfecher closed 5 days ago

jfecher commented 5 days ago

Description

Problem*

Resolves a panic in the type system found in the slices test here https://github.com/noir-lang/noir/pull/5331

Summary*

We weren't recurring in substitute before, so if we had multiple bindings: 1 -> 2 and 2 -> 3 then we may not catch the case were adding 3 -> 1 as well would cause a recursive binding. This simple case was caught previously, but mixing in more bound type variable links would fail this.

Additional Context

Repro is the slices test in https://github.com/noir-lang/noir/pull/5331

Documentation*

Check one:

PR Checklist*