improved diagnostic for function defined with `def`, `fun`, `func`, or `function` instead of `fn` Closes #99751