Skip to content

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

Merged
merged 30 commits into from
May 20, 2021
Merged

Type inf improvements #263

merged 30 commits into from
May 20, 2021

Conversation

ZacLN
Copy link
Contributor

@ZacLN ZacLN commented Feb 11, 2021

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 and infer_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:

@ZacLN ZacLN added this to the Next Minor milestone Feb 11, 2021
@ZacLN ZacLN self-assigned this Feb 11, 2021
pfitzseb
pfitzseb previously approved these changes Feb 12, 2021
Copy link
Member

@pfitzseb pfitzseb left a 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
Copy link
Member

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?

@ZacLN ZacLN marked this pull request as ready for review March 22, 2021 19:39
@ZacLN
Copy link
Contributor Author

ZacLN commented Apr 8, 2021

@pfitzseb this is ready to go. I've added some other code since last reviewed but this is largely unused as of yet.

@oppo-source oppo-source removed the request for review from a team April 16, 2021 07:35
@ZacLN ZacLN requested a review from pfitzseb May 9, 2021 10:43
@davidanthoff davidanthoff assigned pfitzseb and unassigned ZacLN May 12, 2021
@davidanthoff
Copy link
Member

Needs a merge conflict resolution.

@davidanthoff davidanthoff assigned ZacLN and unassigned pfitzseb May 19, 2021
@davidanthoff davidanthoff assigned pfitzseb and unassigned ZacLN May 20, 2021
@davidanthoff davidanthoff merged commit 2ce4ea5 into master May 20, 2021
@davidanthoff davidanthoff deleted the type-inf-improvements branch May 20, 2021 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants