aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools/src
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2018-09-11 09:44:51 +0200
committerHans Bolinder <[email protected]>2018-09-12 12:24:28 +0200
commit1b9128438358155a215c465b5a3d1deb9c4d9965 (patch)
tree4e2ebd611b77ef6fa9ebc767fde6d4270b084a6f /lib/syntax_tools/src
parent2ce90a29d7acd1fa68c0a8f10a21b609f13da899 (diff)
downloadotp-1b9128438358155a215c465b5a3d1deb9c4d9965.tar.gz
otp-1b9128438358155a215c465b5a3d1deb9c4d9965.tar.bz2
otp-1b9128438358155a215c465b5a3d1deb9c4d9965.zip
syntax_tools: Correct erl_syntax:revert/1
revert/1 did not handle the types tuple() and map() correctly.
Diffstat (limited to 'lib/syntax_tools/src')
-rw-r--r--lib/syntax_tools/src/erl_syntax.erl15
1 files changed, 12 insertions, 3 deletions
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.
%% =====================================================================