josefs / Gradualizer

A Gradual type system for Erlang
MIT License
613 stars 35 forks source link

New known problem: refine bound vars with guards #520

Closed erszcz closed 1 year ago

erszcz commented 1 year ago

This defines a known problem for one of the type check errors we discussed in https://github.com/josefs/Gradualizer/pull/512#discussion_r1122806508.

In general, due to #512 there are many more union types being passed around in code, which leads to more places where we have to manually assert which union member we're dealing with. I think using guards more extensively would:

This PR defines just one known problem because so far I only managed to isolate one from #512 changes, but I remember there were more cases like this. Not all are equally easy to reproduce, i.e. sometimes it's not obvious why Gradualizer can't tell which union member it's dealing with. This is connected with how we represent gradualizer_type:abstract_type().

erszcz commented 1 year ago

I see no veto, so I'm merging this. Let me know, please, if you have any comments.