Every example I have found tends to go aa["key"]="value" and even with constants, e.g.:
declare -rA aa=( ["lit1"]="value1" ["lit2"]="value2" )
What is the purpose of this, i.e. does it guard against something I am not foreseeing with literals? The purpose is obvious to me when something is about to be expanded within the quotes, but with constants the code then starts to look less, not more readable.
I checked the two best resources I can think of, the reference and Greg's wiki. It's not explicitly covered anywhere, the former conflates it with regular arrays where it was a non-issue.
echo -e '#!/bin/bash\n declare -rA aa=( [lit1]="value1" [lit2]="value2" ); echo "${aa[@]}"' | shellcheck -. No errors or warnings.shiftor even a pipe|symbol and it worked fine. It's almost like anything inside[ ]is safe as if it were in quotes already. Evendeclare -A A=( [$(echo a) $(echo b)]=1 )appears safe.