Skip to content

Newly created type variables get exactly the jkind from the annotation #3980

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dkalinichenko-js
Copy link
Contributor

Change type annotations on new variables from being upper bounds to being exact values. This makes examples like val f : ('a : value_or_null) -> 'a check 'a : value_or_null properly instead of confusingly inferring 'a : value.

Unfortunately, this makes typechecking dependent on the order annotations: val f2 : ('a : value_or_null) -> 'a -> 'a infers 'a : value_or_null, but val f2' : 'a -> ('a : value_or_null) -> 'a infers 'a : value. We can probably fix this too, by defaulting only at the end when we know there are no annotations on 'a.

It also would be nice to require equality instead of subkinding here. Perhaps it's not OCaml-y, but it's way less confusing.

@goldfirere
Copy link
Collaborator

As discussed on Slack, I think the order-dependence here is pretty bad. I'd like to search for a different solution.

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