From 1b9128438358155a215c465b5a3d1deb9c4d9965 Mon Sep 17 00:00:00 2001 From: Hans Bolinder Date: Tue, 11 Sep 2018 09:44:51 +0200 Subject: syntax_tools: Correct erl_syntax:revert/1 revert/1 did not handle the types tuple() and map() correctly. --- lib/syntax_tools/src/erl_syntax.erl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'lib/syntax_tools/src') diff --git a/lib/syntax_tools/src/erl_syntax.erl b/lib/syntax_tools/src/erl_syntax.erl index 758aff32fd..55cc5b792b 100644 --- a/lib/syntax_tools/src/erl_syntax.erl +++ b/lib/syntax_tools/src/erl_syntax.erl @@ -5455,8 +5455,12 @@ map_type(Fields) -> revert_map_type(Node) -> Pos = get_pos(Node), - {type, Pos, map, map_type_fields(Node)}. - + case map_type_fields(Node) of + any_size -> + {type, Pos, map, any}; + Fields -> + {type, Pos, map, Fields} + end. %% ===================================================================== %% @doc Returns the list of field subtrees of a `map_type' node. @@ -5714,7 +5718,12 @@ tuple_type(Elements) -> revert_tuple_type(Node) -> Pos = get_pos(Node), - {type, Pos, tuple, tuple_type_elements(Node)}. + case tuple_type_elements(Node) of + any_size -> + {type, Pos, tuple, any}; + TypeElements -> + {type, Pos, tuple, TypeElements} + end. %% ===================================================================== -- cgit v1.2.3