diff options
author | Henrik Nord <[email protected]> | 2011-09-21 15:50:31 +0200 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2011-09-21 15:57:41 +0200 |
commit | 3d31498a0d08a9cf572fc966c025ed44ef15e831 (patch) | |
tree | d096ec431ebb41590c3ded7b9f7b57ec3d110c95 /lib/hipe | |
parent | 06b914798569d70e1ecd4769e95d9969fbce97da (diff) | |
parent | 291e32daaaa7f485d67f1ee1e29b802152f9ae42 (diff) | |
download | otp-3d31498a0d08a9cf572fc966c025ed44ef15e831.tar.gz otp-3d31498a0d08a9cf572fc966c025ed44ef15e831.tar.bz2 otp-3d31498a0d08a9cf572fc966c025ed44ef15e831.zip |
Merge branch 'ta/typer-quote-atoms' into dev
* ta/typer-quote-atoms:
Update Dialyzer's reference results
Quote atoms if necessary in types
OTP-9560
Diffstat (limited to 'lib/hipe')
-rw-r--r-- | lib/hipe/cerl/erl_types.erl | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/hipe/cerl/erl_types.erl b/lib/hipe/cerl/erl_types.erl index 1748c1cc16..7ff170776e 100644 --- a/lib/hipe/cerl/erl_types.erl +++ b/lib/hipe/cerl/erl_types.erl @@ -211,7 +211,8 @@ record_field_diffs_to_string/2, subst_all_vars_to_any/1, lift_list_to_pos_empty/1, - is_erl_type/1 + is_erl_type/1, + atom_to_string/1 ]). %%-define(DO_ERL_TYPES_TEST, true). @@ -3360,14 +3361,14 @@ t_to_string(?var(Id), _RecDict) when is_integer(Id) -> record_to_string(Tag, [_|Fields], FieldNames, RecDict) -> FieldStrings = record_fields_to_string(Fields, FieldNames, RecDict, []), - "#" ++ atom_to_list(Tag) ++ "{" ++ string:join(FieldStrings, ",") ++ "}". + "#" ++ atom_to_string(Tag) ++ "{" ++ string:join(FieldStrings, ",") ++ "}". record_fields_to_string([F|Fs], [{FName, _DefType}|FDefs], RecDict, Acc) -> NewAcc = case t_is_any(F) orelse t_is_atom('undefined', F) of true -> Acc; false -> - StrFV = atom_to_list(FName) ++ "::" ++ t_to_string(F, RecDict), + StrFV = atom_to_string(FName) ++ "::" ++ t_to_string(F, RecDict), %% ActualDefType = t_subtract(DefType, t_atom('undefined')), %% Str = case t_is_any(ActualDefType) of %% true -> StrFV; @@ -3393,7 +3394,7 @@ field_diffs([F|Fs], [{FName, DefType}|FDefs], RecDict, Acc) -> case t_is_subtype(F, DefType) of true -> Acc; false -> - Str = atom_to_list(FName) ++ "::" ++ t_to_string(DefType, RecDict), + Str = atom_to_string(FName) ++ "::" ++ t_to_string(DefType, RecDict), [Str|Acc] end, field_diffs(Fs, FDefs, RecDict, NewAcc); @@ -3906,7 +3907,7 @@ t_form_to_string({type, _L, union, Args}) -> string:join(t_form_to_string_list(Args), " | "); t_form_to_string({type, _L, Name, []} = T) -> try t_to_string(t_from_form(T)) - catch throw:{error, _} -> atom_to_list(Name) ++ "()" + catch throw:{error, _} -> atom_to_string(Name) ++ "()" end; t_form_to_string({type, _L, Name, List}) -> io_lib:format("~w(~s)", @@ -3920,6 +3921,11 @@ t_form_to_string_list([H|T], Acc) -> t_form_to_string_list([], Acc) -> lists:reverse(Acc). +-spec atom_to_string(atom()) -> string(). + +atom_to_string(Atom) -> + lists:flatten(io_lib:format("~w", [Atom])). + %%============================================================================= %% %% Utilities |