[erlang-questions] Multiple types with the same name in Dialyzer

Anthony Ramine nox@REDACTED
Thu May 26 11:24:16 CEST 2011


Hi,

I have a type value/1 defined as `-type value(LabelT) :: ...` and I would
like to have a type value/0 with a default LabelT type value like
`-type value() :: value(binary())`. The file compiles just fine but Dialyzer
complains that "Type value is already defined".

This exception is thrown from dialyzer_utils:add_new_type/6 [1] because the arity
is not a part of a type identity, you can see this in erl_types:type_is_defined/3 [2].

What I really don't understand is that while the arity is not a part of it, whether
the given type is opaque or not is, so you can have both `-type t()` and `-opaque t()`.

So I have two questions:

- Is being unable to have both type value/0 and value/1 a bug?
- Does being able to have both type t opaque and non-opaque have any purpose?

Regards,

[1] https://github.com/erlang/otp/blob/dev/lib/dialyzer/src/dialyzer_utils.erl#L223
[2] https://github.com/erlang/otp/blob/dev/lib/hipe/cerl/erl_types.erl#L3984

--
Anthony Ramine
Dev:Extend
http://dev-extend.eu







More information about the erlang-questions mailing list