Reference ID
93440419-4f1c-151b-6f4a-caa2108b4b7f
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Summary
Modifying an array of functions in a transacts context does not abide by transactional behavior; if the enclosing failure context fails, the modification(s) on the array of functions are not rolled back.
Steps to Reproduce
Example:
TestLog := class(log_channel){}
main_device := class(creative_device)
{
var FunctionArray:[]type{_():void} = array{}
OnBegin<override>()<suspends>:void=
{
Print("FunctionArray.Length: {FunctionArray.Length}")
if:
FailableFunction[]
then:
Print("Failable function succeeded: did not roll back.")
else:
Print("Failable function failed: rolled back.")
Print("FunctionArray.Length: {FunctionArray.Length}")
for(Function:FunctionArray)
{
Function()
}
}
PrintFunction():void =
{
Print("123")
}
FailableFunction()<transacts><decides>:void =
{
log{Channel := TestLog}.Print("Entered FailableFunction")
set FunctionArray += array{PrintFunction}
false?
}
}
Expected Result
Expected Log Output:
LogVerse: : FunctionArray.Length: 0
LogVerse: TestLog: (Rolling Back) Entered FailableFunction
LogVerse: : Failable function failed: rolled back.
LogVerse: : FunctionArray.Length: 0
Observed Result
Observed Log Output:
LogVerse: : FunctionArray.Length: 0
LogVerse: TestLog: (Rolling Back) Entered FailableFunction
LogVerse: : Failable function failed: rolled back.
LogVerse: : FunctionArray.Length: 1
LogVerse: : 123
Platform(s)
windows