I dont think this is the same as jaytea's bug as 1 will never evaluate to null.
The first alias could be written as:
alias vartest {
var %anothervar = 1
var %somevar- [ $+ [ 1 ] ] = $rand(1, [ %anothervar ] )
echo var: %somevar- [ $+ [ 1 ] ]
}
set is a special command where the first word wont be evaluated so in fact you dont need evaluation brackets to begin with.
//var %x = 1 , %t $+ %x = cool | echo -a %t1
will echo = cool.
//var %x = 1 , %t $+ %x = cool $rand(1,%x) | echo -a %t1
will reproduce your same error saying invalid format $rand
because it sees ,%x) as a new variable declaration.
This can be seen as a bug in the parser however why have dynamic local variables to begin with ? seems rather pointless to me