print $parameters[nr]
nameref-nameref
This happens because getpmparameter() presumes that gethashnode2() and
getparamnode() will return different results, but resolve_nameref()
called from getparamnode() recognizes that a subscripted referent must
be the stopping point, and so returns its input. This is handled
specially in fetchvalue() after the comment
/* only happens for namerefs pointing to array elements */
so it needs to be handled in getpmparameter() as well. The question
is, what should the result be?
There are many issues with references to subscripted variables. I worked on that a few months ago. I'll have to resume that work. It's probably not possible to fix all issues without major refectorings but it looked like smaller changes could still deliver some progress. One takeaway that I remember is that for any progress the part highlighted above had to go away. As a side effect, this would most certainly change the output of the example above.
The question is, what should the result be?
Given that "$parameters[path[2]]" expands to the empty string, I would expect "$parameters[nr]" to expand to just "nameref". If we ever change "parameters" to return some non-empty value "FOO" for the former then the latter should return "nameref-FOO".
Philippe