Closed leoqiao18 closed 1 year ago
The implementation is now complete. There are a couple of problems left that need to be addressed.
polyref1-fail.ssl
: this PR is now incorrectly type-checking this failure case. A bit of work needs to be done to perform the value restriction technique. (https://github.com/ssm-lang/sslang/actions/runs/3414097454/jobs/5681601441#step:5:513)TypeInferSpec.hs
: there is something weird going on with mangling inside the type inference unit test, causing correct inferences to fail the comparison tests. (https://github.com/ssm-lang/sslang/actions/runs/3414097454/jobs/5681601441#step:5:1990)TypeInferSpec.hs
: I believe typechecks a program with complicated patterns
unit test case is incorrect. (https://github.com/ssm-lang/sslang/actions/runs/3414097454/jobs/5681601441#step:5:2023)Regarding the 4 things above:
polyref1-fail.ssl
: I have added value restriction, so this is throwing error as expected. I am doing a little bit more than our previous type-inference, in that if there is a non-value binding, I will not generalize anything in the recursive binding group, which I think is the correct thing to do.TypeInferSpec.hs
: @j-hui and I will investigate more about the type variable name mangling issue. There should probably be a more sophisticated type variable name mangling functionTypeInferSpec.hs
: the incorrect unit test case is fixed in PR #127 . The previous type inference implementation was not able to detect this incorrectness due to how it was inferring types from patterns (it was using the AnnDCon
annotations generated from lowerAst, instead of inferring from the patterns themselves).The PR is now ready for review and merge.
This PR is version 2 of the constraint-based type inference. This version is going to look different from the first one, so I am making a new PR.
With the learnings from version 1, version 2 aims to implement constraint-based type inference in a cleaner and more fitting approach for sslang codebase.