[Chapel Merge] Apply Michael's patch to fix a leak

Branch: refs/heads/master
Revision: caf146c
Author: e-kayrakli
Log Message:

Merge pull request #17478 from e-kayrakli/fix-shared-tuple-leak

Apply Michael's patch to fix a leak

Resolves https://github.com/Cray/chapel-private/issues/1833

This PR closes a leak that happens when implicitly converting non-nilables
to nilables within tuples. A small reproducer of the issue is:

class C {}

proc foo(const ref arg: (shared C?,)) {
  writeln(arg);
}

proc main() {
  var t1 = (new shared C(), );
  foo(t1);
}

where the workaround was to add an explicit cast while passing the tuple as an argument.

[Developed by @mppf, tested/merged by @e-kayrakli]

Test: