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
Describe the bug
Expressions involving slices returned by functions are not properly treated.
Looks like the expression is memorized in the working memory even when other involved variables have changed and the change is known by the engine.
Your suspicion is correct. The function Fact.GetStrings()[Fact.Index] returns immediately memorized by the engine.
Changing the value of Fact.Index does not make the engine see that this Fact.GetStrings()[Fact.Index] signature need to be removed from the working memory.
Its clearly a bug, since adding Changed("Fact.Index"); does not seem to fix the issue.
But Changed("[Fact.Index]"); do and also Changed("Fact.GetStrings()[Fact.Index]"); .
I suspected that the slice index evaluation value are memorized and not simply forgotten when we add the value of Fact.Index
For temporary solution, You can use this to correct it.
rule test {
when
Fact.Index < Fact.Strings.Len()
then
Fact.Concatenation = Fact.Concatenation + Fact.GetStrings()[Fact.Index];
Fact.Index = Fact.Index + 1;
Changed("[Fact.Index]");
}
Describe the bug
Expressions involving slices returned by functions are not properly treated.
Looks like the expression is memorized in the working memory even when other involved variables have changed and the change is known by the engine.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No error executing TestSliceFunctionTest(t *testing.T)
Additional context
Test logs:
When the same slice is not being referenced from a function it works properly:
The text was updated successfully, but these errors were encountered: