diff --git a/tests/wake-format/basic/basic.wake b/tests/wake-format/basic/basic.wake index cffaf53f6..d88e5bca7 100644 --- a/tests/wake-format/basic/basic.wake +++ b/tests/wake-format/basic/basic.wake @@ -1498,3 +1498,4 @@ def a = a |> b |> c def a = a |< b |< c def a = a |> b |< c def a = a |< b |> c +def a = a | b |> c | c |< d diff --git a/tests/wake-format/basic/stdout b/tests/wake-format/basic/stdout index 2a960c331..068ec1551 100644 --- a/tests/wake-format/basic/stdout +++ b/tests/wake-format/basic/stdout @@ -1802,3 +1802,10 @@ def a = a |< b |> c + +def a = + a + | b + |> c + | c + |< d diff --git a/tools/wake-format/emitter.cpp b/tools/wake-format/emitter.cpp index a3aebd186..fca1aa101 100644 --- a/tools/wake-format/emitter.cpp +++ b/tools/wake-format/emitter.cpp @@ -1389,8 +1389,10 @@ wcl::doc Emitter::walk_binary(ctx_t ctx, CSTElement node) { std::vector parts = {}; if (is_op_left_assoc(op_token)) { if (is_binop_matching_str(op_token, TOKEN_OP_OR, "|>") || - is_binop_matching_str(op_token, TOKEN_OP_OR, "|<")) { - parts = collect_left_binary({{TOKEN_OP_OR, "|>"}, {TOKEN_OP_OR, "|<"}}, node); + is_binop_matching_str(op_token, TOKEN_OP_OR, "|<") || + is_binop_matching_str(op_token, TOKEN_OP_OR, "|")) { + parts = + collect_left_binary({{TOKEN_OP_OR, "|>"}, {TOKEN_OP_OR, "|<"}, {TOKEN_OP_OR, "|"}}, node); } else { parts = collect_left_binary({{op_token.id(), op_token.fragment().segment().str()}}, node); }