-
Notifications
You must be signed in to change notification settings - Fork 29
Type inf improvements #263
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
src/type_inf.jl
Outdated
@@ -57,6 +57,8 @@ function infer_type_assignment_rhs(binding, state, scope) | |||
settype!(binding, CoreTypes.Float64) | |||
elseif CSTParser.isstringliteral(rhs) | |||
settype!(binding, CoreTypes.String) | |||
elseif headof(rhs) === :TRUE || headof(rhs) === :false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why's one head :TRUE
and the other :false
? (C/S)hould we make those consistent?
@pfitzseb this is ready to go. I've added some other code since last reviewed but this is largely unused as of yet. |
Needs a merge conflict resolution. |
Adds some rudimentary inference for elements of arrays.
For type inference by use (i.e. where we infer the type of a variable by the argument slot it sits in in a function call) adds handling for
if
blocks so that the uncertainty of whether a branch is hit is accounted for.Also adds some internal (as yet unused) functions for reasoning about the specific method being used at a call site. The intention is to use this in combination with function return type cached by SymbolServer to improve our inference. [Note - there are currently two different pieces of code that iterate across function methods (
check_call
andinfer_type_by_use
) and use of the functions referenced above would add a third. These should be combined/rationalised.]For every PR, please check the following: