From 1e9e5e18f885c9faaa91a01c958ef59e63ed81ce Mon Sep 17 00:00:00 2001 From: Andy Dienes Date: Sun, 26 Jan 2025 17:07:05 -0800 Subject: [PATCH 1/2] fix `Base.operator_associativity` of ternary --- base/show.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/base/show.jl b/base/show.jl index 42788f05eceb5..d4536ca8739ee 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1665,7 +1665,8 @@ julia> Base.operator_associativity(:⊗), Base.operator_associativity(:sin), Bas """ function operator_associativity(s::Symbol) if operator_precedence(s) in (prec_arrow, prec_assignment, prec_control_flow, prec_pair, prec_power) || - (isunaryoperator(s) && !is_unary_and_binary_operator(s)) || s === :<| || s === :|| + (isunaryoperator(s) && !is_unary_and_binary_operator(s)) || + (s === :<| || s === :|| || s == :?) return :right elseif operator_precedence(s) in (0, prec_comparison) || s in (:+, :++, :*) return :none From 383b9d521e84a637cf4d5257454bda1715246ea9 Mon Sep 17 00:00:00 2001 From: Andy Dienes Date: Sun, 26 Jan 2025 17:12:36 -0800 Subject: [PATCH 2/2] whitespace --- base/show.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/show.jl b/base/show.jl index d4536ca8739ee..ab7aa5925aa9b 100644 --- a/base/show.jl +++ b/base/show.jl @@ -1665,7 +1665,7 @@ julia> Base.operator_associativity(:⊗), Base.operator_associativity(:sin), Bas """ function operator_associativity(s::Symbol) if operator_precedence(s) in (prec_arrow, prec_assignment, prec_control_flow, prec_pair, prec_power) || - (isunaryoperator(s) && !is_unary_and_binary_operator(s)) || + (isunaryoperator(s) && !is_unary_and_binary_operator(s)) || (s === :<| || s === :|| || s == :?) return :right elseif operator_precedence(s) in (0, prec_comparison) || s in (:+, :++, :*)