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.
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
and2 -> 3
then we may not catch the case were adding3 -> 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*
cargo fmt
on default settings.