You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flatty doesnt handle custom range arrays properly #32
These are just some examples, but it extends to any array that does not start at 0. Depending on the array and if 0 can be converted to the index type, they will have a bug at runtime or just will not compile.
import flatty
var
arr: array[-2..0, int]
arr2: array[10..11, int]
for i, x in arr.pairs:
arr[i] = i
for i, x in arr2.pairs:
arr2[i] = i
assert arr2.toFlatty().fromFlatty(array[10..11, int]) == [10, 11] # Compile time errorassert arr.toFlatty().fromFlatty(array[-2..0, int]) == [-2, -1, 0] # Runtime bug
Perhaps instead of your present api you may want to consider
Activity
treeform commentedon Jan 18, 2024
I spent several hours to make ranges work, but I just get very strange and puzzling errors.
I think its some sort of compiler bugs that prevent ranges from working.
treeform commentedon May 25, 2026
Thank you for your issue. I have been working on flatty for a bunch of things, and I think I have fixed this in this PR: #52
Feel free to re-open the issue if it still happens to you.