aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2017-04-10 11:45:28 +0200
committerHans Bolinder <[email protected]>2017-04-10 11:45:28 +0200
commit8fd5553684f0cdf2e7c35733d4b86d6a73f9b576 (patch)
treea55f47caeb64056594ce73e368fba42498ba6fe6 /lib
parent82b17d7334c2449b66feb9ec2195d7b211688557 (diff)
parentcef44e1a526c0624086a6da2d233918a2bd7f6cf (diff)
downloadotp-8fd5553684f0cdf2e7c35733d4b86d6a73f9b576.tar.gz
otp-8fd5553684f0cdf2e7c35733d4b86d6a73f9b576.tar.bz2
otp-8fd5553684f0cdf2e7c35733d4b86d6a73f9b576.zip
Merge branch 'hasse/unicode_atoms/OTP-14285'
* hasse/unicode_atoms/OTP-14285: edoc: Fix a Dialyzer warning
Diffstat (limited to 'lib')
-rw-r--r--lib/edoc/src/edoc_layout.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/edoc/src/edoc_layout.erl b/lib/edoc/src/edoc_layout.erl
index eafab0588e..71ba9a6676 100644
--- a/lib/edoc/src/edoc_layout.erl
+++ b/lib/edoc/src/edoc_layout.erl
@@ -544,7 +544,7 @@ t_clause(Name, Type, Opts) ->
pp_clause(Pre, Type, Opts) ->
Types = ot_utype([Type]),
- Atom = lists:duplicate(string:length(Pre), $a),
+ Atom = lists:duplicate(string_length(Pre), $a),
Attr = {attribute,0,spec,{{list_to_atom(Atom),0},[Types]}},
L1 = erl_pp:attribute(erl_parse:new_anno(Attr),
[{encoding, Opts#opts.encoding}]),
@@ -566,7 +566,7 @@ format_type(Prefix, _Name, Type, Last, Opts) ->
[{tt, Prefix ++ [" = "] ++ t_utype(Type, Opts) ++ Last}].
pp_type(Prefix, Type, Opts) ->
- Atom = list_to_atom(lists:duplicate(string:length(Prefix), $a)),
+ Atom = list_to_atom(lists:duplicate(string_length(Prefix), $a)),
Attr = {attribute,0,type,{Atom,ot_utype(Type),[]}},
L1 = erl_pp:attribute(erl_parse:new_anno(Attr),
[{encoding, Opts#opts.encoding}]),
@@ -768,6 +768,18 @@ atom(String, #opts{encoding = latin1}) ->
atom(String, #opts{encoding = utf8}) ->
io_lib:write_atom(list_to_atom(String)).
+-dialyzer({nowarn_function, string_length/1}).
+string_length(Data) ->
+ try iolist_size(Data)
+ catch
+ _:_ ->
+ try string:length(Data)
+ catch
+ _:_ ->
+ 20
+ end
+ end.
+
%% <!ATTLIST author
%% name CDATA #REQUIRED
%% email CDATA #IMPLIED