Skip to content

Infer with-kinds for GADTs, using Tof_kind for existentials #3814

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

Open
wants to merge 27 commits into
base: aspsmith/of-kind
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a714717
With-kinds for GADTs, first pass
glittershark Apr 4, 2025
cbe43dc
Some attempts at breaking abstract types with existentials
glittershark Apr 4, 2025
00c505e
Don't keep around abstract types over existentials
glittershark Apr 6, 2025
9b4a05a
Demonstrate a remaining issue
glittershark Apr 6, 2025
4e66cf4
an attempt: thread through *all* unbound type vars
glittershark Apr 6, 2025
d3e635e
sure why not just subst the existentials
glittershark Apr 12, 2025
4e17669
i am a diabolical mad scientist
glittershark Apr 12, 2025
60616a0
another problem
glittershark Apr 12, 2025
d3e7aa2
actually, ptyp_any is fine, it just prints weird
glittershark Apr 12, 2025
7a038e6
use tof_kind for existentials
glittershark Apr 14, 2025
d2dc097
Clean up the mess
glittershark Apr 15, 2025
914f8d2
Add a debug printer for row_desc
glittershark Apr 12, 2025
668b3c4
Don't try to put Tof_kind in a row variable
glittershark Apr 15, 2025
43fb25e
Pull logic back into Jkind.ml
glittershark Apr 15, 2025
a90f40f
Add a test for a tricky, unimplemented mode-crossing case
glittershark Apr 15, 2025
66baef3
Add some more tests + comments as requested by review
glittershark Apr 15, 2025
00a31cb
More tests
glittershark Apr 15, 2025
cef2e1f
explain
glittershark Apr 15, 2025
23f5501
Remove unnecessary forward decl
glittershark Apr 15, 2025
4f4f4d7
Add a Note and references, and a new test
glittershark Apr 15, 2025
731f688
Tof_kind should have a best kind
glittershark Apr 15, 2025
3445419
Merge branch 'aspsmith/of-kind' into aspsmith/with-kinds-for-gadts
glittershark Apr 23, 2025
96266d9
Tweak + extend tests
glittershark Apr 23, 2025
08a59b3
Don't exclude row variables in existentials
glittershark Apr 23, 2025
fd3310a
Merge branch 'aspsmith/of-kind' into aspsmith/with-kinds-for-gadts
glittershark Apr 25, 2025
8dbf45f
Update testsuite/tests/typing-jkind-bounds/gadt.ml
glittershark Apr 25, 2025
072fe6e
Update typing/jkind.ml
glittershark Apr 25, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jane/doc/proposals/kind-inference.md
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ m_portability = portable
Γ ⊢ κᵢ ≤ χᵢ
κ₀' = κ₀{τsⱼ/[['aᵢ]]}
∀ Ξ:
mode m_Ξ ≤ Ξ(κ₀')
mode mⱼ_Ξ ≤ Ξ(κ₀')
∀ σ ∈ types_for(Ξ, field_typesⱼ), with σ ≤ Ξ(κ₀')
value ≤ lay(κ₀')
if [@@unboxed]:
Expand Down
10 changes: 2 additions & 8 deletions testsuite/tests/parsetree/source_jane_street.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1258,14 +1258,8 @@ type existential_abstract : immutable_data with (type : value mod portable) abst
| Mk : ('a : value mod portable) abstract -> existential_abstract
[%%expect{|
type 'a abstract
Lines 2-3, characters 0-67:
2 | type existential_abstract : immutable_data with (type : value mod portable) abstract =
3 | | Mk : ('a : value mod portable) abstract -> existential_abstract
Error: The kind of type "existential_abstract" is value
because it's a boxed variant type.
But the kind of type "existential_abstract" must be a subkind of
immutable_data with (type : value mod portable) abstract
because of the annotation on the declaration of the type existential_abstract.
type existential_abstract =
Mk : ('a : value mod portable). 'a abstract -> existential_abstract
|}]

(* not yet supported *)
Expand Down
Loading