It's possible to change any readonly associative array to the indexed array (''):
$ declare -rA var=([foo]=bar) $ f() { declare -ng COMPREPLY=var; } $ compgen -F f . bash: compgen: warning: -F option may not work as you expect $ declare -p var declare -ar var=([0]="")