diff options
author | Hans Bolinder <[email protected]> | 2016-06-10 10:32:04 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2016-06-10 10:32:04 +0200 |
commit | 7dd54b5a89d382689562ea19e7ff96daf5b65290 (patch) | |
tree | dcdab1be7b8aa4f155951a2ab22c164ff133c9d5 /lib/stdlib/src/erl_parse.yrl | |
parent | 599b3cd3d802f09a9f921f44e72418e7d7ad1a06 (diff) | |
parent | 0d1c055fd82fa71ca4db08d7827de4d20d2f1241 (diff) | |
download | otp-7dd54b5a89d382689562ea19e7ff96daf5b65290.tar.gz otp-7dd54b5a89d382689562ea19e7ff96daf5b65290.tar.bz2 otp-7dd54b5a89d382689562ea19e7ff96daf5b65290.zip |
Merge branch 'hasse/dialyzer/improve_from_form/OTP-13547'
* hasse/dialyzer/improve_from_form/OTP-13547:
Update primary bootstrap
stdlib: Correct types and specs
dialyzer: Minor adjustments
dialyzer: Suppress unmatched_return for send/2
dialyzer: Improve the translation of forms to types
dialyzer: Use a cache when translating forms to types
dialyzer: Prepare erl_types:t_from_form() for a cache
dialyzer: Optimize erl_types:t_form_form()
dialyzer: Correct types
syntax_tools: Correct types
erts: Correct character repr in doc of the abstract format
stdlib: Correct types and specs
Diffstat (limited to 'lib/stdlib/src/erl_parse.yrl')
-rw-r--r-- | lib/stdlib/src/erl_parse.yrl | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/lib/stdlib/src/erl_parse.yrl b/lib/stdlib/src/erl_parse.yrl index 1de09aae62..85b2816451 100644 --- a/lib/stdlib/src/erl_parse.yrl +++ b/lib/stdlib/src/erl_parse.yrl @@ -531,7 +531,7 @@ Erlang code. -compile([{hipe,[{regalloc,linear_scan}]}]). -export_type([abstract_clause/0, abstract_expr/0, abstract_form/0, - abstract_type/0, error_info/0]). + abstract_type/0, form_info/0, error_info/0]). %% Start of Abstract Format @@ -543,7 +543,6 @@ Erlang code. | af_export() | af_import() | af_export_type() - | af_optional_callbacks() | af_compile() | af_file() | af_record_decl() @@ -570,9 +569,6 @@ Erlang code. -type af_ta_list() :: [{type_name(), arity()}]. --type af_optional_callbacks() :: - {'attribute', anno(), 'optional_callbacks', af_fa_list()}. - -type af_compile() :: {'attribute', anno(), 'compile', any()}. -type af_file() :: {'attribute', anno(), 'file', {string(), anno()}}. @@ -864,16 +860,22 @@ Erlang code. | af_unary_op(af_singleton_integer_type()) | af_binary_op(af_singleton_integer_type()). --type af_literal() :: af_atom() | af_integer() | af_float() | af_string(). +-type af_literal() :: af_atom() + | af_character() + | af_float() + | af_integer() + | af_string(). -type af_atom() :: af_lit_atom(atom()). -type af_lit_atom(A) :: {'atom', anno(), A}. --type af_integer() :: {'integer', anno(), non_neg_integer()}. +-type af_character() :: {'char', anno(), char()}. -type af_float() :: {'float', anno(), float()}. +-type af_integer() :: {'integer', anno(), non_neg_integer()}. + -type af_string() :: {'string', anno(), string()}. -type af_match(T) :: {'match', anno(), af_pattern(), T}. @@ -941,6 +943,10 @@ Erlang code. -type type_name() :: atom(). +-type form_info() :: {'eof', erl_anno:line()} + | {'error', erl_scan:error_info() | error_info()} + | {'warning', erl_scan:error_info() | error_info()}. + %% End of Abstract Format %% XXX. To be refined. @@ -1500,8 +1506,9 @@ type_preop_prec('#') -> {700,800}. | abstract_type(). -spec map_anno(Fun, Abstr) -> NewAbstr when - Fun :: fun((Anno) -> Anno), + Fun :: fun((Anno) -> NewAnno), Anno :: erl_anno:anno(), + NewAnno :: erl_anno:anno(), Abstr :: erl_parse_tree(), NewAbstr :: erl_parse_tree(). @@ -1510,14 +1517,14 @@ map_anno(F0, Abstr) -> {NewAbstr, []} = modify_anno1(Abstr, [], F), NewAbstr. --spec fold_anno(Fun, Acc0, Abstr) -> NewAbstr when +-spec fold_anno(Fun, Acc0, Abstr) -> Acc1 when Fun :: fun((Anno, AccIn) -> AccOut), Anno :: erl_anno:anno(), Acc0 :: term(), + Acc1 :: term(), AccIn :: term(), AccOut :: term(), - Abstr :: erl_parse_tree(), - NewAbstr :: erl_parse_tree(). + Abstr :: erl_parse_tree(). fold_anno(F0, Acc0, Abstr) -> F = fun(A, Acc) -> {A, F0(A, Acc)} end, @@ -1525,8 +1532,9 @@ fold_anno(F0, Acc0, Abstr) -> NewAcc. -spec mapfold_anno(Fun, Acc0, Abstr) -> {NewAbstr, Acc1} when - Fun :: fun((Anno, AccIn) -> {Anno, AccOut}), + Fun :: fun((Anno, AccIn) -> {NewAnno, AccOut}), Anno :: erl_anno:anno(), + NewAnno :: erl_anno:anno(), Acc0 :: term(), Acc1 :: term(), AccIn :: term(), @@ -1542,7 +1550,9 @@ mapfold_anno(F, Acc0, Abstr) -> Abstr :: erl_parse_tree(). new_anno(Term) -> - map_anno(fun erl_anno:new/1, Term). + F = fun(L, Acc) -> {erl_anno:new(L), Acc} end, + {NewAbstr, []} = modify_anno1(Term, [], F), + NewAbstr. -spec anno_to_term(Abstr) -> term() when Abstr :: erl_parse_tree(). |