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

Postfix function type annotations don't make it past type inference #62

Open
hmontero1205 opened this issue Dec 8, 2021 · 4 comments
Open

Comments

@hmontero1205
Copy link
Contributor

hmontero1205 commented Dec 8, 2021

In the following example:

foo (w: Int) (z: Int) -> Int =
  w + z

I had to annotate the function args "inline". The following equivalent:

foo w z: Int -> Int -> Int =
  w + z

Results in this error being thrown: TypeError "Cannot change empty Ann type to Classes type".

@hmontero1205
Copy link
Contributor Author

@XijiaoLi , just a thought:

Should we have an explicit pass that attempts to unify the function args' type signatures with the postfix type signature (if one was provided)?

@XijiaoLi
Copy link
Contributor

XijiaoLi commented Dec 8, 2021

Sure, that sounds good to me.

@j-hui
Copy link
Contributor

j-hui commented Dec 9, 2021

This looks like a bug with the lowering phase. I'll take a look tomorrow.

Should we have an explicit pass that attempts to unify the function args' type signatures with the postfix type signature (if one was provided)?

This shouldn't be necessary (as its own thing). The lowering phase should essentially distribute all the argument type annotations into a stack of type annotations. We just need to handle the general case of unifying multiple type annotations (which Xijiao and I already spoke about on Tuesday).

@j-hui
Copy link
Contributor

j-hui commented Aug 25, 2022

This is being handled in #103

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

No branches or pull requests

3 participants