-
Notifications
You must be signed in to change notification settings - Fork 174
Add Hindley-Milner type inference module #917
Conversation
swernli
left a comment
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.
Changes look good! The InferenceContext.fs file has a lot of logic that is hard to internalize when coming at the code fresh, so I'm wondering if it might be worth having a readme in the TypeInference folder with some brief descriptions of the high level concepts/strategy and a link to external info on Hindley-Milner type inference.
|
@swernli I added a readme. Can you take a look at it? |
|
@SamarSha The readme is fantastic! Concise and still very informative for interpreting the accompanying code. |
bettinaheim
left a comment
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.
I am blocking the PR for now since I believe in its current state it would break some of the IDE commands due to the change in assigning ranges to types even when there is no matching piece of source code.
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.
I think this setup make things a lot cleaner, thanks. I am still waiting for a response regarding SearchAndReplace; we need to update the transformation to not use the deprecated handles. The syntax tree transformation currently walks both the old and the new handle, which I believe would cause issues.
The concern has been partially addressed, and since this goes against a feature branch, making the update of SeearchAndReplace a separate PR makes sense.
This PR splits out the HM type inference module from #884, as well as additional changes that the module requires. The new module is not used by the compiler, so there's no change to type inference behavior yet (there will be another PR for that).
Additional changes:
ResolvedTypeso that the HM module can generate diagnostics with accurate locations.WithinIfConditionfield fromScopeContextthat has been deprecated for 6 months.