diff options
author | Hans Bolinder <[email protected]> | 2016-01-15 12:55:20 +0100 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-01-15 12:55:20 +0100 |
commit | 48f225fbdf7ce87297a3ac61d9c85dc2f598c953 (patch) | |
tree | 846ffea731e5f2c54589c112d6a7e47797ff9c5a /lib | |
parent | 459fe1e1a6ca7218bdd41539ed2771631439bae5 (diff) | |
parent | e8e62f6de3919799d87f9d8805e75390b16b4eba (diff) | |
download | otp-48f225fbdf7ce87297a3ac61d9c85dc2f598c953.tar.gz otp-48f225fbdf7ce87297a3ac61d9c85dc2f598c953.tar.bz2 otp-48f225fbdf7ce87297a3ac61d9c85dc2f598c953.zip |
Merge branch 'maint'
* maint:
dialyzer: Correct handling of parameters of opaque types
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hipe/cerl/erl_types.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index ab5a57dc3d..67cdcd35e3 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -2686,7 +2686,6 @@ is_compat_args([A1|Args1], [A2|Args2]) -> is_compat_args([], []) -> true; is_compat_args(_, _) -> false. -is_compat_arg(A, A) -> true; is_compat_arg(A1, A2) -> is_specialization(A1, A2) orelse is_specialization(A2, A1). @@ -2697,6 +2696,7 @@ is_compat_arg(A1, A2) -> %% any(). For example, {_,_} is a specialization of any(), but not of %% tuple(). Does not handle variables, but any() and unions (sort of). +is_specialization(T, T) -> true; is_specialization(_, ?any) -> true; is_specialization(?any, _) -> false; is_specialization(?function(Domain1, Range1), ?function(Domain2, Range2)) -> @@ -2722,8 +2722,8 @@ is_specialization(?tuple(Elements1, Arity, _), specialization_list(Elements1, sup_tuple_elements(List)); is_specialization(?tuple_set(List1), ?tuple_set(List2)) -> try - specialization_list(lists:append([T || {_Arity, T} <- List1]), - lists:append([T || {_Arity, T} <- List2])) + specialization_list_list([sup_tuple_elements(T) || {_Arity, T} <- List1], + [sup_tuple_elements(T) || {_Arity, T} <- List2]) catch _:_ -> false end; is_specialization(?union(List1)=T1, ?union(List2)=T2) -> @@ -2747,13 +2747,19 @@ is_specialization(T1, ?opaque(_) = T2) -> is_specialization(T1, t_opaque_structure(T2)); is_specialization(?var(_), _) -> exit(error); is_specialization(_, ?var(_)) -> exit(error); -is_specialization(T, T) -> true; is_specialization(?none, _) -> false; is_specialization(_, ?none) -> false; is_specialization(?unit, _) -> false; is_specialization(_, ?unit) -> false; is_specialization(#c{}, #c{}) -> false. +specialization_list_list(LL1, LL2) -> + length(LL1) =:= length(LL2) andalso specialization_list_list1(LL1, LL2). + +specialization_list_list1([], []) -> true; +specialization_list_list1([L1|LL1], [L2|LL2]) -> + specialization_list(L1, L2) andalso specialization_list_list1(LL1, LL2). + specialization_list(L1, L2) -> length(L1) =:= length(L2) andalso specialization_list1(L1, L2). |