Replies: 1 comment 3 replies
-
Hi, @xxdavid! Indeed, polymorphism support in Gradualizer is currently limited. There's some work in progress on solving constraints on type variables in #284 and #450. The former is the original work by @josefs, whereas the latter is my rebase to a more recent commit of the master branch together with some tests showing what new bugs would actually be caught and some config details to enable/disable constraint solving. However, the latter PR, apart from discovering issues similar to the ones you bring up, exhibits a number of new false positives and noise when running the Gradualizer self-check, so it's not ready for prime time yet. For example: ebin/gradualizer_lib.beam: The variable on line 31 at column 21 is expected to have type fun((_TyVar-576460752303417503, _TyVar-576460752303417471,
_TyVar-576460752303417439) ->
_TyVar-576460752303417407) but it has type fun((...) -> any())
merge_with(F, M1, M2) -> maps:merge_with(F, M1, M2). These issues are caused due to (at least) the following reasons:
Until recently we also had a more serious issue in the type checker implementation - #458. Personally, I'm trying to make Gradualizer as useful as possible as soon as possible, which in practice means minimising the number of crashes and false positives it generates. I'm gauging this by the number of errors it generates when checking itself, but also by dogfooding on other projects, or by running broader analyses like #464. Following the above approach, my current target was #461, since it allows to shed a few lines of self-check errors. This is now on the last mile, but calendar-wise it might still be a while due to the amount of time I can spend on this project. If you, or anyone else, would like to work on the solver in the meantime, then go for it! If you're interested from the perspective of a user, then it's definitely on the roadmap ;) |
Beta Was this translation helpful? Give feedback.
-
Hi, what is the current state of polymorphism support in Gradualizer? I get the impression that Gradualizer can deal with polymorphic types but it actually fails to catch obviously looking bugs when using
lists:map
.Here are my two test files:
Gradualizer's output is clean on both files.
Beta Was this translation helpful? Give feedback.
All reactions