The bug
The /function
command with if
or unless
always fails when it is executed in a function.
How to reproduce
Create a function
custom:test
function custom:test2 if @s
Create a function
custom:test2
say test2
Run the function
custom:test
/function custom:test
→ "test2" is not printed
Note: As workaround you can use /execute
execute @s ~ ~ ~ /function custom:test2 if @s
For me it doesn't work