Skip to content

Use generic types in call to subtype - #13464

Merged
goldfirere merged 3 commits into
ocaml:trunkfrom
goldfirere:generic-instance-in-subtype
Oct 8, 2024
Merged

goldfirere merged 3 commits into
ocaml:trunkfrom
goldfirere:generic-instance-in-subtype

Conversation

@goldfirere

Copy link
Copy Markdown
Contributor

This is a small change within the type-checker to use generic-level types in the call to subtype, used to implement the :> operator.

The change here causes no known change in behavior. However, in Jane Street's branch, we sometimes use information about whether a type in principally known to make decisions about which modes to pay attention to; this change does make a differece in that branch. The reason I'm posting it here is that I think this small change in the code makes it a bit more semantically correct: the types in question are written by the user and therefore really should be treated at generic-level.

I think @garrigue is the right reviewer for this.

@goldfirere

Copy link
Copy Markdown
Contributor Author

@garrigue and I discussed last week, and my sense at the time was that this patch looked good to him. @garrigue, are you ready to Approve? Thanks!

@garrigue garrigue left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code is modified the way we discussed, giving the improved behavior on single coercions.
The modified output for recursive types is a bit confusing, but the types are semantically equivalent. Eventually it may be worth defining better the amount of unsharing caused by annotations.

@goldfirere
goldfirere force-pushed the generic-instance-in-subtype branch from 566d565 to c9872ee Compare October 8, 2024 14:38
@goldfirere
goldfirere merged commit da6636e into ocaml:trunk Oct 8, 2024
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.

2 participants