aboutsummaryrefslogtreecommitdiffstats
path: root/lib/hipe/cerl
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2015-06-10 08:42:33 +0200
committerHans Bolinder <[email protected]>2015-06-15 12:27:41 +0200
commitd65264ca24c966402876aa6f9127be8810310255 (patch)
tree3df65950661a78026aa2334fd26dd5ff75382942 /lib/hipe/cerl
parentb109768baf023a0814bda37b452582c7b396ada2 (diff)
downloadotp-d65264ca24c966402876aa6f9127be8810310255.tar.gz
otp-d65264ca24c966402876aa6f9127be8810310255.tar.bz2
otp-d65264ca24c966402876aa6f9127be8810310255.zip
dialyzer: Fix a minor bug concerning opaque types
The test t_is_none() does not check for opaque types (and this is most likely how it should be), why t_opaque() should never be called with none().
Diffstat (limited to 'lib/hipe/cerl')
-rw-r--r--lib/hipe/cerl/erl_types.erl18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl
index 1531d96324..d39f350c0f 100644
--- a/lib/hipe/cerl/erl_types.erl
+++ b/lib/hipe/cerl/erl_types.erl
@@ -753,7 +753,7 @@ t_opaque_from_records(RecDict) ->
%% List = lists:zip(ArgNames, Args),
%% TmpVarDict = dict:from_list(List),
%% Rep = t_from_form(Type, RecDict, TmpVarDict),
- Rep = t_none(), % not used for anything right now
+ Rep = t_any(), % not used for anything right now
Args = [t_any() || _ <- ArgNames],
t_opaque(Module, Name, Args, Rep)
end, OpaqueRecDict),
@@ -4240,8 +4240,14 @@ type_from_form(Name, Args, TypeNames, ET, M, MR, V, D, L) ->
false -> {t_any(), L1}
end,
Rep1 = choose_opaque_type(Rep, Type),
- Args2 = [subst_all_vars_to_any(ArgType) || ArgType <- ArgTypes],
- {t_opaque(Module, Name, Args2, Rep1), L2};
+ Rep2 = case t_is_none(Rep1) of
+ true -> Rep1;
+ false ->
+ Args2 = [subst_all_vars_to_any(ArgType) ||
+ ArgType <- ArgTypes],
+ t_opaque(Module, Name, Args2, Rep1)
+ end,
+ {Rep2, L2};
error ->
Msg = io_lib:format("Unable to find type ~w/~w\n", [Name, ArgsLen]),
throw({error, Msg})
@@ -4289,7 +4295,11 @@ remote_from_form(RemMod, Name, Args, TypeNames, ET, M, MR, V, D, L) ->
{t_any(), L1}
end,
NewRep1 = choose_opaque_type(NewRep, Type),
- {t_opaque(Mod, Name, ArgTypes, NewRep1), L2};
+ NewRep2 = case t_is_none(NewRep1) of
+ true -> NewRep1;
+ false -> t_opaque(Mod, Name, ArgTypes, NewRep1)
+ end,
+ {NewRep2, L2};
error ->
Msg = io_lib:format("Unable to find remote type ~w:~w()\n",
[RemMod, Name]),