infer if test and fn arg type