-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Describe the bug
Hello,
when trying to use individual array elements as function outputs
module exposes do_something
function calc_speed()(x : float32 , y : float32)
x = 5
y = 3
end
activity do_something()()
var V : [2] float32 = { 0, 0 }
calc_speed()(V[0], V[1] )
await true
end
I got this error :
error: Write-write conflict. V or an alias thereof occurs multiple times in the output list of the sub program call.
--> prog.blc:13:2 [causality]
13 | calc_speed()(V[0], V[1] )
| ---- First occurence of output argument.
13 | calc_speed()(V[0], V[1] )
| ^^^^ Subsequent alias of the same output argument.
If this usage is intended, consider using the "shares" keyword when declaring the formal parameters of the subprogram.
Expected behaviour
It's clear that this program is safe. in case of runtime indexes it's very difficult for the compiler to verify the safety. in this case the programmer should have a mechanism to disable safety checks