From 42f8c3a4ebef20903ff000a85aff69a49e2a9890 Mon Sep 17 00:00:00 2001 From: Kyrylo Simonov Date: Sun, 18 Feb 2024 20:28:52 -0600 Subject: [PATCH] Fix serializing (x -> y)(z) (fix #7) --- docs/src/test.md | 3 +++ src/expr.jl | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/src/test.md b/docs/src/test.md index f3edd47..fcb8aa6 100644 --- a/docs/src/test.md +++ b/docs/src/test.md @@ -373,6 +373,7 @@ is supported. const t1 = (1,) const t2 = (1,2,3) const p = 1 => 2 + (x->y)(z) Base.show(Base.stdout) Base.@show Base.stdout println("x = $x") @@ -471,6 +472,8 @@ is supported. const p = 1 => 2 + (x -> y)(z) + Base.show(Base.stdout) Base.@show Base.stdout diff --git a/src/expr.jl b/src/expr.jl index 2ff1e91..5877820 100644 --- a/src/expr.jl +++ b/src/expr.jl @@ -523,7 +523,11 @@ function tile_expr_call(fn, args, pr) sep = sep) end else - list_layout(Layout[tile_expr(arg, 0) for arg in args], prefix = tile_expr(fn)) + prefix = tile_expr(fn) + if !@isexpr fn Expr(:. || :curly || :macroname, _...) + prefix = literal("(") * prefix * literal(")") + end + list_layout(Layout[tile_expr(arg, 0) for arg in args], prefix = prefix) end end