Currently, when a function uses return without a value, we treat it as returning void. This is a problem for functions with a dynamic return type, because void is currently not accepted as a valid return type for dynamic functions. This PR enables dynamic functions to accept void as a return type.
Alternatively, we could instead evaluate return as return invalid; but this would require additional logic to handle this case for subs, which (because they're void functions) are only supposed to accept void return types.
It turns out that RBI doesn't allow an empty return in a function using the function keyword -- it causes a compile error. So this is not a bug, but a feature 😉
Change Summary
Currently, when a function uses
return
without a value, we treat it as returningvoid
. This is a problem for functions with adynamic
return type, because void is currently not accepted as a valid return type for dynamic functions. This PR enablesdynamic
functions to acceptvoid
as a return type.Alternatively, we could instead evaluate
return
asreturn invalid
; but this would require additional logic to handle this case forsub
s, which (because they're void functions) are only supposed to accept void return types.