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

Process uncurried application in the type checker. #5835

Merged
merged 6 commits into from
Nov 23, 2022

Conversation

cristianoc
Copy link
Collaborator

  • Do the processing of uncurried application in the type checker.
  • Add support for default arguments in uncurried functions.
  • Add custom error messages for uncurried application.
  • Uncurried pipe processing does not require special handling.

The current encoding is based on arity. To support default arguments one cannot just look at the number of supplied arguments, but to know whether the required arguments are supplied one needs to inspect the function type.

- Do the processing of uncurried application in the type checker.
- Add support for default arguments in uncurried functions.
- Add custom error messages for uncurried application.
- Uncurried pipe processing does not require special handling.

The current encoding is based on arity. To support default arguments one cannot just look at the number of supplied arguments, but to know whether the required arguments are supplied one needs to inspect the function type.
@cristianoc
Copy link
Collaborator Author

This is an example that currently crashes the compiler (all versions):

let foo = (. ~x) => { let _ = (); (~y) => x+y }

let d = foo(. ~y=3)

Illustrates that it's not enough to count the number of arguments supplied. Here the number of arguments, 1, is correct, but the application looks further in the type than it should.

Handling the application in the type checker gives enough flexibility to handle this issue with a small change later on.

@cristianoc
Copy link
Collaborator Author

Handling the application in the type checker gives enough flexibility to handle this issue with a small change later on.

Here: 173989a

@cristianoc cristianoc mentioned this pull request Nov 23, 2022
15 tasks
@cristianoc
Copy link
Collaborator Author

Test that this does not break existing uncurried tests in .ml files: #5837

@cristianoc cristianoc merged commit 4242f3b into master Nov 23, 2022
@cristianoc cristianoc deleted the uncurried_application_in_type_checker branch November 23, 2022 13:07
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.

None yet

1 participant