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

Improve inference for --new-typechecker #2524

Merged
merged 15 commits into from
Nov 28, 2023
Merged

Improve inference for --new-typechecker #2524

merged 15 commits into from
Nov 28, 2023

Conversation

janmasrovira
Copy link
Collaborator

@janmasrovira janmasrovira commented Nov 20, 2023

This pr applies a number of fixes to the new typechecker.
The fixes implemented are:

  1. When guessing the arity of the body, we properly use the type information of the variables in the patterns.
  2. When generating wildcards, we name them properly so that they align with the name in the type signature.
  3. When compiling named applications, we inline all clauses of the form fun : _ := body. This is a workaround to Bug in typechecking (inference generates ill-scoped terms) #2247 and Typechecking infers incorrect types #2517
  4. I've had to ignore test027 (Church numerals). While the typechecker passes and one can see that the types are correct, there is a lambda where its clauses have different number of patterns. Our goal is to support that in the near future (Functions with clauses with differing number of patterns type-check but are not correctly compiled #1706). This is the conflicting lambda:
    mutual num : Nat → Num
      := λ : Nat → Num {| (zero : Nat) := czero
      | ((suc n : Nat)) {A} := csuc (num n) {A}}
    
  5. I've added non-trivial a compilation test involving monad transformers.

@janmasrovira janmasrovira added this to the 0.5.5 milestone Nov 20, 2023
@janmasrovira janmasrovira self-assigned this Nov 20, 2023
@janmasrovira janmasrovira force-pushed the improve-inference branch 4 times, most recently from f092769 to 68645d2 Compare November 23, 2023 10:43
@janmasrovira janmasrovira changed the title Improve inference Improve inference for --new-typechecker Nov 24, 2023
@janmasrovira janmasrovira marked this pull request as ready for review November 24, 2023 10:05
Copy link
Collaborator

@paulcadman paulcadman left a comment

Choose a reason for hiding this comment

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

I also tested compilation of juvix-containers etc. with the new typechecker.

@janmasrovira
Copy link
Collaborator Author

I also tested compilation of juvix-containers etc. with the new typechecker.

thanks!

@janmasrovira janmasrovira merged commit d6c1a74 into main Nov 28, 2023
4 checks passed
@janmasrovira janmasrovira deleted the improve-inference branch November 28, 2023 15:43
paulcadman pushed a commit that referenced this pull request Nov 28, 2023
Adds all existing negative tests for the new typechecker.
- Depends on #2524
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.

2 participants