Deduplicate lamda captures

This example

entity ex(
	arg: uint<8>,
) {
		let reqs: [uint<8>; 1] = [0];
    let reqs: [uint<8>; 1] = reqs
			.map(fn |i| {
					trunc(arg + arg)
			});
}

fails with the following error:

error: Multiple arguments with the same name
  ┌─ /tmp/lol.spade:2:2

2 │     arg: uint<8>,
  │     ^^^
  │     │
  │     arg later declared here
  │     arg previously declared here

error: {unknown} does not have any methods
   ┌─ <compiler dir>/stdlib/array.spade:36:14

36 │             [f.call((self[0],))].concat(self[1..N].map(f))
   │              ^

Error: aborting due to previous error

Location:
    spade-compiler/src/main.rs:174:17

Which is rather confusing. It turns out that this is a bug in the lambda variable capture code which creates a type definition with as many declarations for a capture as there are uses.

Merge request reports

Loading