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
module test {type Option[a]= Some(a)| None
pure def findFirst(l, f)= l.foldl(None,(a, i)=>if(a == None and f(i)) Some(i)else a)
pure val foo =[1,2,3].findFirst(i =>{[9, i].findFirst(j => j >0)== None
})}
calling foo in the REPL yields the wrong result:
$ quint -r local/test.qnt::test
Quint REPL 0.22.4
Type ".exit" to exit, or ".help" for more information
>>> foo
Some(9)
it should be impossible for this to result in 9 as it is not part of [1, 2, 3].
The problem happens because the new evaluator's lambda registries has a single registry per parameter, for optimization reasons. However, in this particular case, we need to have two separate instances of these registers, as some of them need to keep the accumulator and element of the outter call and others for the accumulator and element of the inner call.
I can't think of a way to reproduce this without using nested user-defined operators that use folds, so I hope this is not affecting too much. I'll look for a solution ASAP.
The text was updated successfully, but these errors were encountered:
Found this nasty problem:
calling foo in the REPL yields the wrong result:
it should be impossible for this to result in
9
as it is not part of[1, 2, 3]
.The problem happens because the new evaluator's lambda registries has a single registry per parameter, for optimization reasons. However, in this particular case, we need to have two separate instances of these registers, as some of them need to keep the accumulator and element of the outter call and others for the accumulator and element of the inner call.
I can't think of a way to reproduce this without using nested user-defined operators that use folds, so I hope this is not affecting too much. I'll look for a solution ASAP.
The text was updated successfully, but these errors were encountered: