Skip to content

Commit 1292f7c

Browse files
committed
Support unions in macro arguments
1 parent e647588 commit 1292f7c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/erlfmt_parse.yrl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ macro_string -> '?' '?' atom_or_var :
590590
{macro_string, ?range_anno('$1', '$3'), '$3'}.
591591

592592
macro_expr -> expr : '$1'.
593+
macro_expr -> expr '|' expr : ?mkop2('$1', '$2', '$3').
593594
macro_expr -> expr 'when' macro_expr_guard : ?mkop2('$1', '$2', '$3').
594595

595596
macro_expr_guard -> expr : {guard_or, ?anno('$1'), ['$1']}.

test/erlfmt_format_SUITE.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3389,7 +3389,8 @@ macro(Config) when is_list(Config) ->
33893389
23
33903390
),
33913391
?assertSame("?macro(Expr when Guard1; Guard2)\n"),
3392-
?assertFormat("?foo(X,)\n", "?foo(X)\n").
3392+
?assertFormat("?foo(X,)\n", "?foo(X)\n"),
3393+
?assertSame("?macro(Expr, t1() | t2())\n").
33933394

33943395
function(Config) when is_list(Config) ->
33953396
?assertSame("f() -> ok.\n"),

0 commit comments

Comments
 (0)