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:testfunction custom:test2 if @sCreate a function
custom:test2say test2Run 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