Edit: checking return statement should use checkReturnType