From e5e9caa2ee2188444e06ea1e162eb23375ca7538 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 4 Jun 2026 09:06:02 +0200 Subject: 54674: ::= didn't respect parameter flags The documentation says ${name::=word} In the first form, if name is unset then set it to word; in the second form, if name is unset or null then set it to word; and in the third form, unconditionally set name to word. In all forms, the value of the parameter is then substituted. Particularly that "the value of the parameter is substituted", not "the word is substituted". This is what happens before the fix, and similarly for array flags like "unique": % typeset -E3 fl; hi=5; echo ${fl::=hi} hi % echo $fl 5.00e+00 --- Test/D04parameter.ztst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Test') diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 68c4ec288..57de28c72 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -82,6 +82,19 @@ >wasnull2d >wasnull2d + typeset -Z3 zerothree + print ${zerothree::=15} + typeset -E3 ethree + five=5 + print ${ethree::=five} + typeset -a -U uniquearr + typeset -a duplicates=(1 2 1 1 2 3) + print ${(A)uniquearr::=$duplicates} +0:::= respects expansion flags +>015 +>5.00e+00 +>1 2 3 + unset array print ${#${(A)=array=word}} 0:${#${(A)=array=word}} counts array elements -- cgit v1.3.1