testsuite batch97: prefix readonly-through-nameref declare error - #308
Merged
Conversation
…arget declare/typeset/local already prefixed a readonly-assignment failure with the builtin name, but only for a direct readonly variable; assigning through a nameref to a readonly target (`declare -r foo0=x; declare -n ref=foo0; declare ref=X') fell through to Shell::set and printed the bare target name (`foo0: readonly variable'). Resolve the nameref for the readonly test but report the name as written, matching bash's `declare: ref: readonly variable'. This also collapses the readonly empty-nameref case (`typeset -n r; typeset -r r; typeset r=x') to the single prefixed message bash prints instead of a bare line plus a prefixed one.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batch 97 —
namereftest 237 → 235. Extends batch94's declare readonly-prefix conformance to the nameref case.declare/typeset/local prefix a readonly-assignment failure with the builtin name, but only did so for a direct readonly variable. Assigning through a nameref to a readonly target fell through to
Shell::setand printed the bare target name:Now the nameref is resolved for the readonly test but the diagnostic reports the name as written (
ref), matching bash. This also collapses the readonly empty-nameref case (typeset -n r; typeset -r r; typeset r=x) from gnash's bare-line-plus-prefixed-line to the single prefixed message bash prints.ctest22/22,run_diffall 234 scripts match bash. No regressions (varenv, declare unchanged).The deeper nameref17 remainders (
typeset +n/+ron a readonly nameref, function-scope readonly namerefs) and the quoted-vs-unquoteddeclare -n a=(...)compound-assignment distinction remain — the latter needs parse-time compound-assignment tracking gnash doesn't preserve in a builtin's argv.