Re: Unsettling dialyzer errors
Josef Svenningsson <[email protected]>
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <CAGF=PZKf8g_L83AQHaO29Cg1Si_JpVNGonFbg1a8Jwpbj-s_0A@mail.gmail.com> |
On Sun, Feb 28, 2021 at 9:12 PM Nicolas Martyanoff <[email protected]> wrote: > Josef Svenningsson <[email protected]> writes: > > > On 2/28/21 11:39 AM, Josef Svenningsson wrote: > > No, Gradualizer is not saying that foo/1 should take arguments of type > > t1(). It's saying that the program calls f1/1 with a variable of type > > t1()|t2() but the declared type of f1/1 only accepts arguments of t1(). > > Hence the error. > > Gradualizer looks at the declared types of functions and will report an > > error if there is an incompatibility, but it doesn't "expect" the types > to > > be anything. > This is the behaviour I expect from a type checker. Too many times, I > end up with errors about types that Dialyzer itself inferred, > having to find out how they relate to the type specifications I > provided. > > I'll try to run Gradualizer on my main codebase, it should be quite > interesting. > > I'm glad to hear you're giving it a try. Given that you've used Dialyzer in the past and it treats specs somewhat differently compared to Gradualizer, be prepared to have to alter the specs somewhat. But I hope that it should be relatively straightforward. Gradualizer is designed to be a fairly conventional type system so if you have experience with those before then I think you should feel at home. Let us know if anything trips you up. Cheers, Josef