Closed ameliatastic closed 1 year ago
(@mcintyre94, from the referenced issue)
This might be tricky to fix because the comment suggests we don't have type info about the array there
Nah, I was just being lazy when I wrote this initially. Type info is saved in the expr.ty
field, which is used in a few different contexts. It's a little annoying to work with though.
Side note, I desperately need to come up with better code patterns for matching against common types like ints/floats/strings/etc. - the biblically accurate match statements are really not convenient to write.
...im staring at the code i just wrote, which i have tested on multiple inputs and all but confirmed that it works, and have no idea why it works
UPDATE: Figured it out, I was just looking at the wrong type. expr.ty
is the return type of the call to sum
, which is the same type as the type being iterated over (sum(Iter<T>) -> T
). I was wondering how I was getting type T
when I thought I was looking at the type of the iterable
, which should be (and is) Iter<T>
.
Closes #83