about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Src/builtin.c4
-rw-r--r--Src/params.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index fff0b641f..8d8ff68e0 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2837,7 +2837,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	    unqueue_signals();
 	    return 1;
 	} else if (pm) {
-	    if (!(pm->node.flags & PM_UNSET)
+	    if ((!(pm->node.flags & PM_UNSET) || pm->node.flags & PM_DECLARED)
 		&& (locallevel == pm->level || !(on & PM_LOCAL))) {
 		if (pm->node.flags & PM_TIED) {
 		    if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
@@ -2933,7 +2933,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	if (asg->value.array) {
 	    int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
 	    assignaparam(asg->name, zlinklist2array(asg->value.array, 1), flags);
-	} else /*if (asg0.value.scalar || oldval)*/ {
+	} else if (asg0.value.scalar || oldval) {
 	    /* We have to undo what we did wrong with asg2 */
 	    apm->node.flags &= ~PM_DECLAREDNULL;
 	    if (oldval)
diff --git a/Src/params.c b/Src/params.c
index 1a047d9e0..c09a3eccf 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -4125,6 +4125,11 @@ tiedarrsetfn(Param pm, char *x)
 
     if (*dptr->arrptr)
 	freearray(*dptr->arrptr);
+    else if (pm->ename) {
+	Param altpm = (Param) paramtab->getnode(paramtab, pm->ename);
+	if (altpm)
+	    altpm->node.flags &= ~PM_DECLAREDNULL;
+    }
     if (x) {
 	char sepbuf[3];
 	if (imeta(dptr->joinchar))