roc icon indicating copy to clipboard operation
roc copied to clipboard

Specialize types pass

Open rtfeldman opened this issue 1 year ago • 1 comments

This isn't trying to do anything with expressions yet; all it does is that you give it a Variable and Subs and it monomorphizes that variable.

This is based on the cor implementation at https://github.com/ayazhafiz/cor/blob/b67174d98b6dde16809b3606f9f88d4863d8743f/experiments/lss/monotype/lower_type.ml#L62-L63

rtfeldman avatar Oct 08 '24 11:10 rtfeldman

Yeah I plan to add specialize_expr which does the expr cloning part next, at which point I'll throw out these tests. I mainly just wanted to give myself a sense of this part working in isolation before getting exprs involved.

Great point about cloning the variable! I think the way we want to do that is to make a new var here: https://github.com/roc-lang/roc/pull/7149/files#diff-17f90baf2650b85b580fc6e1b09ed4277812b36c92697d17f2473dba5a5c615cR77

...and then change the next line to cache.set_monomorphic(new_var); return new_var; yeah?

rtfeldman avatar Oct 08 '24 19:10 rtfeldman

Thank you for your contribution! Sometimes PRs end up staying open for a long time without activity, which can make the list of open PRs get long and time-consuming to review. To keep things manageable for reviewers, this bot automatically closes PRs that haven’t had activity in 60 days. This PR hasn’t had activity in 30 days, so it will be automatically closed if there is no more activity in the next 30 days. Keep in mind that PRs marked Closed are not deleted, so no matter what, the PR will still be right here in the repo. You can always access it and reopen it anytime you like!

github-actions[bot] avatar Nov 15 '24 02:11 github-actions[bot]