diff options
author | Fredrik Gustafsson <[email protected]> | 2013-02-20 14:34:22 +0100 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-02-20 14:34:22 +0100 |
commit | 973eecebb6ba42f44f44a9166cb861818b3f9265 (patch) | |
tree | bfe8e5debc96f6b5ddbafb080abcaad0ad8c948d /lib/dialyzer/src/dialyzer_utils.erl | |
parent | 53f9cfae0612b19e34ec7eb5a404709c449c162c (diff) | |
parent | a8b0dc0f6bc5bbf1330c6fa55a50198c40998eb4 (diff) | |
download | otp-973eecebb6ba42f44f44a9166cb861818b3f9265.tar.gz otp-973eecebb6ba42f44f44a9166cb861818b3f9265.tar.bz2 otp-973eecebb6ba42f44f44a9166cb861818b3f9265.zip |
Merge branch 'sa/dialyzer-types-arity/OTP-10861'
* sa/dialyzer-types-arity/OTP-10861:
Minor refactoring
Update Dialyzer's documentation
Support for types with the same name and different arity
Diffstat (limited to 'lib/dialyzer/src/dialyzer_utils.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_utils.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/dialyzer/src/dialyzer_utils.erl b/lib/dialyzer/src/dialyzer_utils.erl index 8046b48838..dc8e825199 100644 --- a/lib/dialyzer/src/dialyzer_utils.erl +++ b/lib/dialyzer/src/dialyzer_utils.erl @@ -219,15 +219,18 @@ get_record_and_type_info([], _Module, Records, RecDict) -> end. add_new_type(TypeOrOpaque, Name, TypeForm, ArgForms, Module, RecDict) -> - case erl_types:type_is_defined(TypeOrOpaque, Name, RecDict) of + Arity = length(ArgForms), + case erl_types:type_is_defined(TypeOrOpaque, Name, Arity, RecDict) of true -> - throw({error, flat_format("Type ~s already defined\n", [Name])}); + Msg = flat_format("Type ~s/~w already defined\n", [Name, Arity]), + throw({error, Msg}); false -> ArgTypes = [erl_types:t_from_form(X) || X <- ArgForms], case lists:all(fun erl_types:t_is_var/1, ArgTypes) of true -> ArgNames = [erl_types:t_var_name(X) || X <- ArgTypes], - dict:store({TypeOrOpaque, Name}, {Module, TypeForm, ArgNames}, RecDict); + dict:store({TypeOrOpaque, Name, Arity}, + {Module, TypeForm, ArgNames}, RecDict); false -> throw({error, flat_format("Type declaration for ~w does not " "have variables as parameters", [Name])}) |