Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:25
erlang
1809-erl_types-Optimize-t_limit-2.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 1809-erl_types-Optimize-t_limit-2.patch of Package erlang
From 3eedb53f20cf9d7a15c4f5460a8816e6f8e6969e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Sat, 5 Nov 2022 04:49:12 +0100 Subject: [PATCH 09/12] erl_types: Optimize t_limit/2 --- lib/dialyzer/src/erl_types.erl | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/dialyzer/src/erl_types.erl b/lib/dialyzer/src/erl_types.erl index 14b80de9ff..3c0af514e0 100644 --- a/lib/dialyzer/src/erl_types.erl +++ b/lib/dialyzer/src/erl_types.erl @@ -3822,11 +3822,12 @@ is_limited(?tuple(?any, ?any, ?any), _K) -> true; is_limited(?tuple(Elements, _Arity, _), K) -> if K =:= 1 -> false; true -> - K1 = K-1, - lists:all(fun(E) -> is_limited(E, K1) end, Elements) + are_all_limited(Elements, K - 1) end; is_limited(?tuple_set(_) = T, K) -> - lists:all(fun(Tuple) -> is_limited(Tuple, K) end, t_tuple_subtypes(T)); + are_all_limited(t_tuple_subtypes(T), K); +is_limited(?list(Elements, ?nil, _Size), K) -> + is_limited(Elements, K - 1); is_limited(?list(Elements, Termination, _Size), K) -> if K =:= 1 -> is_limited(Termination, K); true -> is_limited(Termination, K - 1) @@ -3835,10 +3836,9 @@ is_limited(?list(Elements, Termination, _Size), K) -> is_limited(?function(Domain, Range), K) -> is_limited(Domain, K) andalso is_limited(Range, K-1); is_limited(?product(Elements), K) -> - K1 = K-1, - lists:all(fun(X) -> is_limited(X, K1) end, Elements); + are_all_limited(Elements, K - 1); is_limited(?union(Elements), K) -> - lists:all(fun(X) -> is_limited(X, K) end, Elements); + are_all_limited(Elements, K); is_limited(?opaque(Es), K) -> lists:all(fun(#opaque{struct = S}) -> is_limited(S, K) end, Es); is_limited(?map(Pairs, DefK, DefV), K) -> @@ -3850,6 +3850,11 @@ is_limited(?map(Pairs, DefK, DefV), K) -> andalso is_limited(DefK, K1) andalso is_limited(DefV, K1); is_limited(_, _K) -> true. +are_all_limited([E|Es], K) -> + is_limited(E, K) andalso are_all_limited(Es, K); +are_all_limited([], _) -> + true. + t_limit_k(_, K) when K =< 0 -> ?any; t_limit_k(?tuple(?any, ?any, ?any) = T, _K) -> T; t_limit_k(?tuple(Elements, Arity, _), K) -> @@ -3858,6 +3863,9 @@ t_limit_k(?tuple(Elements, Arity, _), K) -> end; t_limit_k(?tuple_set(_) = T, K) -> t_sup([t_limit_k(Tuple, K) || Tuple <- t_tuple_subtypes(T)]); +t_limit_k(?list(Elements, ?nil, Size), K) -> + NewElements = t_limit_k(Elements, K - 1), + ?list(NewElements, ?nil, Size); t_limit_k(?list(Elements, Termination, Size), K) -> NewTermination = if K =:= 1 -> -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor