aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syntax_tools
diff options
context:
space:
mode:
Diffstat (limited to 'lib/syntax_tools')
-rw-r--r--lib/syntax_tools/src/erl_prettypr.erl39
-rw-r--r--lib/syntax_tools/test/syntax_tools_SUITE_data/type_specs.erl9
2 files changed, 11 insertions, 37 deletions
diff --git a/lib/syntax_tools/src/erl_prettypr.erl b/lib/syntax_tools/src/erl_prettypr.erl
index 119d375746..f1615b2610 100644
--- a/lib/syntax_tools/src/erl_prettypr.erl
+++ b/lib/syntax_tools/src/erl_prettypr.erl
@@ -1130,13 +1130,14 @@ lay_2(Node, Ctxt) ->
any_size ->
text("map()");
Fs ->
- {Prec, _PrecR} = type_preop_prec('#'),
- Es = lay_map_fields(Fs,
- floating(text(",")),
- reset_prec(Ctxt)),
+ Ctxt1 = reset_prec(Ctxt),
+ Es = seq(Fs,
+ floating(text(",")), Ctxt1,
+ fun lay/2),
D = beside(floating(text("#{")),
beside(par(Es),
floating(text("}")))),
+ {Prec, _PrecR} = type_preop_prec('#'),
maybe_parentheses(D, Prec, Ctxt)
end;
@@ -1400,36 +1401,6 @@ lay_error_info(T, Ctxt) ->
lay_concrete(T, Ctxt) ->
lay(erl_syntax:abstract(T), Ctxt).
-lay_map_fields([H | T], Separator, Ctxt) ->
- case T of
- [] ->
- [case erl_syntax:type(H) of
- map_type_assoc ->
- lay_last_type_assoc(H, Ctxt);
- _ ->
- lay(H, Ctxt)
- end];
- _ ->
- [maybe_append(Separator, lay(H, Ctxt))
- | lay_map_fields(T, Separator, Ctxt)]
- end;
-lay_map_fields([], _, _) ->
- [empty()].
-
-lay_last_type_assoc(Node, Ctxt) ->
- Name = erl_syntax:map_type_assoc_name(Node),
- Value = erl_syntax:map_type_assoc_value(Node),
- IsAny = fun({type,_,any,[]}) -> true;
- %% ({var,_,'_'}) -> true;
- (_) -> false
- end,
- case IsAny(Name) andalso IsAny(Value) of
- true ->
- text("...");
- false ->
- lay_type_assoc(Name, Value, Ctxt)
- end.
-
lay_type_assoc(Name, Value, Ctxt) ->
Ctxt1 = reset_prec(Ctxt),
D1 = lay(Name, Ctxt1),
diff --git a/lib/syntax_tools/test/syntax_tools_SUITE_data/type_specs.erl b/lib/syntax_tools/test/syntax_tools_SUITE_data/type_specs.erl
index 5621d3a293..e4f8a1c3de 100644
--- a/lib/syntax_tools/test/syntax_tools_SUITE_data/type_specs.erl
+++ b/lib/syntax_tools/test/syntax_tools_SUITE_data/type_specs.erl
@@ -49,9 +49,12 @@
-type m1() :: #{} | map().
-type m2() :: #{a := m1(), b => #{} | fy:m2()}.
--type m3() :: #{...}.
--type m4() :: #{_ => _, ...}.
--type m5() :: #{any() => any(), ...}. % Currently printed as `#{..., ...}'.
+%-type m3() :: #{...}.
+%-type m4() :: #{_ => _, ...}.
+%-type m5() :: #{any() => any(), ...}.
+-type m3() :: #{any() => any()}.
+-type m4() :: #{_ => _, any() => any()}.
+-type m5() :: #{any() => any(), any() => any()}.
-type b1() :: B1 :: binary() | (BitString :: bitstring()).
-define(PAIR(A, B), {(A), (B)}).