jinko-core / jinko

Jinko is a small and safe interpreted language with fast Rust and C FFI
GNU General Public License v2.0
32 stars 6 forks source link

Add typeset flattening #674

Closed CohenArthur closed 1 week ago

CohenArthur commented 5 months ago

Currently type widening only works for "one level" and does not support nesting. This is a problem for the typesystem, and also prevents #673 from being merged since the expected type of arithmetic functions is float | int, which an integer literal is not directly part of.

This will require either a pass to flatten all of our multitypes or doing some recursive set checks when going through the checker pass. I think the flattening pass is easier, but it will also be more memory hungry