Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bogus self reference error with -nu



function () {
  typeset -nu ref1=foo
  echo ref1=$ref1
  typeset -nu ref2=ref2
  echo ref2=$ref2
}

Output
ref1=
(anon):3: ref2: invalid self reference

The second reference ref2 should behave like the first one ref1. There is no ref2 in the upper scope, so there should be no self reference error.

Once that bug is fixed, it's worth testing the following where the two references should again behave the same.

function () {
  typeset -nu ref1=foo
  typeset foo=init
  ref1=assign
  echo ref1=$ref1
  typeset -nu ref2=ref2
  ref2=assign
  echo ref2=$ref2
}
typeset -p foo ref2

Expected output:
ref1=
ref2=
bug-bogus-nu-self-ref.zsh:typeset:10: no such variable: foo
bug-bogus-nu-self-ref.zsh:typeset:10: no such variable: ref2

Philippe




Messages sorted by: Reverse Date, Date, Thread, Author