Skip to content

Fix let annotation handling #226

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 1 commit into from
Oct 10, 2024
Merged

Conversation

NeilKleistGao
Copy link
Member

The annotation for let-binding was not handled correctly:

// the annotation `forall 'a : 'a -> 'a` is ignored
fun foo(f) =
  let g: forall 'a : 'a -> 'a = x => f(x) in g(123)
//│ fun foo: forall 'a. (123 -> 'a) -> 'a

fun foo(f) =
  let g = (x => f(x)): forall 'a : 'a -> 'a in g(123)
//│ fun foo: (??a -> ??a0) -> 123

This simple PR fixed this problem so that two given functions above have the same type:

fun foo(f) =
  let g = (x => f(x)): forall 'a : 'a -> 'a in g(123)
//│ fun foo: (??a -> ??a0) -> 123

fun foo(f) =
  let g: forall 'a : 'a -> 'a = x => f(x) in g(123)
//│ fun foo: (??a -> ??a0) -> 123

@NeilKleistGao NeilKleistGao added the bug Something isn't working label Oct 10, 2024
Copy link
Contributor

@LPTK LPTK left a comment

Choose a reason for hiding this comment

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

Oh! That's a good catch, thanks.

@LPTK LPTK merged commit a7504bb into hkust-taco:mlscript Oct 10, 2024
1 check passed
@LPTK LPTK deleted the let-anno branch October 10, 2024 05:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants