-
Notifications
You must be signed in to change notification settings - Fork 77
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
Is it possible to compute a more precise type? #814
Comments
I'm checking this, I'm actually surprised that it type checks without giving an error. |
I suspect I may have something in there to handle this as a special case, since normally having something like To the bigger question, I think inferring that the type is |
Just to avoid any confusion: more precise than I agree with Mark, the question is why it type checks at all since |
I agree that probably the most surprising observation is that this code passes the type checker, |
I'm currently not using subtype to check this but am instead using I guess I can tighten the checks up and see what fails... |
Consider the following program (non-sensical since it will trow an exception for the missing key
3
):This program is accepted by the type checker but the type assigned to
matched[3]
isvoid
.I handle this case in the compiler by falling back to the general
equal
primitive rather than using the more efficientint_equal_int
.Question: it seems that the type checker could infer that
matched
has typemap[int,int]
based on its use. Would that be hard to add or does it require a complete pass of backward propagating type information?The text was updated successfully, but these errors were encountered: