Skip to content
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 annotated binders #150

Merged
merged 38 commits into from
Apr 18, 2023
Merged

Type annotated binders #150

merged 38 commits into from
Apr 18, 2023

Conversation

yiming-fang
Copy link
Contributor

@yiming-fang yiming-fang commented Mar 25, 2023

This PR adds type annotations/holes to all binders in lets, lambdas, and patterns, which get filled during the elaboration pass of type inference.

@j-hui
Copy link
Contributor

j-hui commented Apr 18, 2023

This is passing all tests locally. Thank you so much @yiming-fang and @leoqiao18 for helping me port this!

Since the changes are quite large, I'm just going to go ahead and format all the files we touched. In particular, I think the typechecker and IR.IR need reformatting since I never did those post-Brittany.

@j-hui
Copy link
Contributor

j-hui commented Apr 18, 2023

Oh right, @yiming-fang is still working on getting lambda lifting working with recursive functions (which should also close #111). Since that's orthogonal to this PR, maybe you could merge that in on a separate PR?

@yiming-fang
Copy link
Contributor Author

Oh right, @yiming-fang is still working on getting lambda lifting working with recursive functions (which should also close #111). Since that's orthogonal to this PR, maybe you could merge that in on a separate PR?

Sure, I can open a separate PR for lambda lifting mutually recursive lets.

Comment on lines 41 to 51
-- consDefs <- constrainDefs defs finalConstraint
-- let annsVarPairs = map (uncarryAttachment . fst) binderDefs
-- -- vars = map snd annsVarPairs
-- exprTyps = map (TVarN . snd . uncarryAttachment . snd) binderDefs
-- forBinders ((ann, var), exprTyp) =
-- exists [var] <$> do
-- Ann.withAnnotations ann (TVarN var) \varExp ->
-- return $ CEqual varExp exprTyp
-- constraints <- mapM forBinders (zip annsVarPairs exprTyps)
-- return $ CAnd (consDefs : constraints)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to remove this commented-out block of code when I committed my fix. Could you help me clean this up @yiming-fang

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than this, I have no other suggestions. This PR is looking good!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to remove this commented-out block of code when I committed my fix. Could you help me clean this up @yiming-fang

Done!

Copy link
Contributor

@j-hui j-hui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approve of my own code and everyone else's

@yiming-fang yiming-fang merged commit a3ec27d into main Apr 18, 2023
@yiming-fang yiming-fang deleted the type-annotated-binders branch April 18, 2023 23:42
@j-hui j-hui mentioned this pull request Apr 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants