ocaml-flambda / flambda-backend

The Flambda backend project for OCaml
106 stars 76 forks source link

Implement `Nullability` axis for jkinds #2666

Closed dkalinichenko-js closed 3 months ago

dkalinichenko-js commented 4 months ago

Implement Nullability axis for jkinds, ordered Non_null < Or_null.

Implement two new legacy jkinds: value_or_null and any_non_null. The first will be used for 'a or_null, while the second will be the jkind of array type parameters.

Mark sort variables as always Non_null for now. This is incorrect, but setting it to Or_null requires a lot of changes to the typing algorithm.

Split Jkind.has_layout_any from Jkind.is_any and handle existing callsites.

Test the new jkinds.

ccasin commented 3 months ago

(Sorry it has taken me a few days to get to this - I plan to review today)

ccasin commented 3 months ago

I started reading this, and what I've read so far looks reasonable, but I wonder if we should hold off on this PR until @liam923's rework of jkind.ml is done. These two PRs are pretty conflicty, and that one has a lot of moving pieces. Also he's adding a notion of jkind abbreviation (not yet available for users, but at least in jkind.ml) which will handle the new kinds added here (value_non_null and any_non_null) well.

dkalinichenko-js commented 3 months ago

Not ready for review pending design discussion.