diff options
author | Hans Bolinder <[email protected]> | 2014-02-03 10:27:39 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2014-02-22 19:05:47 +0100 |
commit | 85a5aca047ea4c3dcdeb1e47cdf523a48140bf18 (patch) | |
tree | 48792bcd4ed41c9e8a974c1dc42f425dc8c0a970 /lib/dialyzer/src/dialyzer_contracts.erl | |
parent | f58b946a2d1c1b9c8fa9701932ca2ee21bd7dd5b (diff) | |
download | otp-85a5aca047ea4c3dcdeb1e47cdf523a48140bf18.tar.gz otp-85a5aca047ea4c3dcdeb1e47cdf523a48140bf18.tar.bz2 otp-85a5aca047ea4c3dcdeb1e47cdf523a48140bf18.zip |
Introduce parameterized opaque types
Handle immediate opaque types as aliases:
A declaration of dict/0
-opaque dict() :: dict(_, _).
-opaque dict(Key, Value) :: ...
is handled as an alias, that is, when using dict() it is immediately
replaced by dict(_, _).
This is a means to avoid having to handle equivalent opaque types
later. To be changed if it doesn't work well.
Diffstat (limited to 'lib/dialyzer/src/dialyzer_contracts.erl')
-rw-r--r-- | lib/dialyzer/src/dialyzer_contracts.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/dialyzer/src/dialyzer_contracts.erl b/lib/dialyzer/src/dialyzer_contracts.erl index 3467ab4e65..5b2c52b2d0 100644 --- a/lib/dialyzer/src/dialyzer_contracts.erl +++ b/lib/dialyzer/src/dialyzer_contracts.erl @@ -404,7 +404,8 @@ contract_from_form([{type, _, 'fun', [_, _]} = Form | Left], RecDict, throw({error, NewMsg}) end, NewType = erl_types:t_solve_remote(Type, ExpTypes, AllRecords), - {NewType, []} + NewTypeNoVars = erl_types:subst_all_vars_to_any(NewType), + {NewTypeNoVars, []} end, NewTypeAcc = [TypeFun | TypeAcc], NewFormAcc = [{Form, []} | FormAcc], @@ -418,7 +419,8 @@ contract_from_form([{type, _L1, bounded_fun, process_constraints(Constr, RecDict, ExpTypes, AllRecords), Type = erl_types:t_from_form(Form, RecDict, VarDict), NewType = erl_types:t_solve_remote(Type, ExpTypes, AllRecords), - {NewType, Constr1} + NewTypeNoVars = erl_types:subst_all_vars_to_any(NewType), + {NewTypeNoVars, Constr1} end, NewTypeAcc = [TypeFun | TypeAcc], NewFormAcc = [{Form, Constr} | FormAcc], |