checker: fix and improve return stmt error messages
Fix #17473
This doesn't look correct. You should be able to do return none because of the ? declaration as the return type. You just shouldn't be able to return anything else.
I would expect this particular error to be something like "can only return none from an Option-only return function" or something similar.
This doesn't look correct. You should be able to do
return nonebecause of the?declaration as the return type. You just shouldn't be able to return anything else.I would expect this particular error to be something like "can only return
nonefrom an Option-only return function" or something similar.
Return none is ok. The problem is the multiple return. This is what I am checking.
Your current error message doesn't say anything about what the problem is...
error: unexpected argument, current function does not return anything
This is incorrect, as it could return none, but it might not return anything (if it succeeded). That's why I suggested an alternative error message, which directly relates to the problem.
Your current error message doesn't say anything about what the problem is...
error: unexpected argument, current function does not return anythingThis is incorrect, as it could return
none, but it might not return anything (if it succeeded). That's why I suggested an alternative error message, which directly relates to the problem.
Ah Yes. Agreed.