-
-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add builtin List.walkWithIndexUntil
#6258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. You will probably need to run ui and mono tests, but we'll see if CI passes or not.
If they fail just run cargo test -p test_mono -p uitest --no-fail-fast
and commit the changes.
Hmm, won't have time to troubleshoot failing tests until this evening. |
|
The test that was failing CI before took a while to track down, because I wasn't using release mode initially, and there was another test that was failing in dev mode. |
This time it's not a flake:
@brian-carroll do you have any ideas how 676405809512461could have been the output for:
|
Nope! |
For anyone willing to debug; I recommend:
|
I plan to start poking at the problem this weekend unless someone beats me to it. |
Either a) omitting List.walkWithIndexUntil [5, 7, 2, 3] 0 (\state, elem, index ->
if elem % 2 == 0 then
Break state
else
Continue (elem + state) Or b) converting all ints to List.walkWithIndexUntil [5, 7, 2, 3] 0 (\state, elem, index ->
if elem % 2 == 0 then
Break state
else
a = Num.toI64 elem
b = Num.toI64 state
c = Num.toI64 index
Continue (a + b + c) result in a passing test. So it appears there is some issue with adding an |
Hmm, this fails: #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_addition() {
assert_evals_to!(
r#"
foo : Int Natural # !!
foo = 1
bar : Int *
bar = 1
foo + bar
"#, 2, i64);
} But this passes: #[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn int_addition() {
assert_evals_to!(
r#"
foo : Nat # !!
foo = 1
bar : Int *
bar = 1
foo + bar
"#, 2, i64);
} |
Nice reduction, what's the result for |
Oops, yeah that would be helpful wouldn't it 😅
backtrace:
|
Actually, foo : Int Natural
foo = 1
foo Is enough to cause an error, and not just in wasm. |
For what it's worth, doing a similar test for List.walkWithIndex [5, 7, 2, 3] 0 (\state, elem, index ->
state + elem + index
) result:
So it looks like this issue is probably unrelated to the new function |
Yes indeed, I'd be ok with modifying the tests to avoid them failing using Can you make issues for the problems you encountered @sandprickle? |
Put a bandaid on the test. @Anton-4 I'll try to get those issues filed tonight after work. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sandprickle!
First contribution to builtins. Open to any and all feedback!
(Contribution suggested here: https://roc.zulipchat.com/#narrow/stream/231634-beginners/topic/Sudoku.20Solver/near/407095970)