Makes sense, done!
Anna Maniscalco (ada8db66) at 27 Jan 15:10
Deduplicate lambda captures
Just noticed the typo in the commit message and todo CI was complaining about. Fixed that too
Anna Maniscalco (7035b5df) at 25 Jan 16:35
Deduplicate lambda captures
You are welcome!
Should be addressed.
Anna Maniscalco (1b5e51ff) at 21 Jan 23:19
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.
Anna Maniscalco (78ff7b06) at 18 Jan 19:19
Deduplicate lamda captures
Anna Maniscalco (9dcec060) at 18 Jan 19:08
Deduplicate lamda captures
Anna Maniscalco (1107eed6) at 22 May 16:57
Initial commit