[erlang-questions] dialyzer underspecs warning
Sat Aug 9 08:24:11 CEST 2014
On Fri, Aug 08, 2014 at 04:13:08PM +0200, Kostis Sagonas wrote:
> On 08/08/2014 01:19 PM, Krzesimir Sarnecki wrote:
> >I'm learning how to use -specs + dialyzer and I encountered a problem.
> >I hope you could help me deal with it.
> >This is my test function:
> >test(Array, N, Value) ->
> > array:set(N, Value, Array).
> >And this ia a spec I wrote for it:
> >-spec test(array:array(T), non_neg_integer(), T) -> array:array(T).
> >When I run dialyzer with -Wunderspecs flag it gives me a warning:
> >Type specification test:test(array:array(T),non_neg_integer(),T)
> >-> array:array(T) is a supertype of the success typing: (very long
> >To my surprise when I change a spec to:
> >-spec test(array:array(T), non_neg_integer(), _) -> array:array(T).
> >Dialyzer doesn't give me the warning anymore.
> >Am I missing something or dialyzer is telling me that T is a supertype
> >of any()?
> You are not missing anything. I looks like this is a bug that should be
> fixed. (*)
> Thanks for reporting the issue!
> (*) Most likely this has to do with the recent changes that allow
> polymorphic opaque data types to work considerably better than they used to,
> but obviously not perfectly yet.
More information about the erlang-questions