New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type checks should be done after default is applied. #102
Comments
The complexity is that the type check code is looking at The problem comes when the type check asks "should I do the type check"? If an argument is optional it will check to see if it exists first, but it will check I think the logic for "should I do a type check" should be...
|
Actually, I thought we talked about this before and decided that type-checking an explicit default value was unnecessary overhead, vaguely akin to type-checking the invocant (which, you may recall my pointing out, could also potentially catch bugs ;-> ). Bu I suppose if there's a bug, that overrides any concerns about overhead. Your logic looks good to me. I'll merge the pull request and toss it out as a dev release. |
Type check *after* the default is applied. For #102
Oh yeah, I did say that. Changing this to not type check default values at all (or at compile time) would make sense EXCEPT when the default is computed like |
The generated code for
$greeting
is this.Which boils down to that the type check is done before the default is applied. It should happen after the default is applied.
This also has the benefit of type checking the default avoiding this bug.
The text was updated successfully, but these errors were encountered: