[Chapel Merge] Adjust untyped array formals with defaults

Branch: refs/heads/master
Revision: 72cefe1
Author: mppf
Log Message:

Merge pull request #16457 from mppf/untyped-array-formals

Adjust untyped array formals with defaults

This PR changes the behavior of programs like the following:

var DD = {1..4};
var AA : [DD] int;

proc defaultsValue(in D = {1..4}, in A = builder(D)) {
  // Is A.domain actually D or actually DD ?
  // (In other words, which domain, when modified, will change A?)

proc builder(D : domain(1)) {
  var R : [D] int;
  return R;

Previous to this PR, the compiler took the runtime type from the formal
argument’s default expression even when an actual argument was provided
(as in the case above). After this PR, the runtime type from the actual
argument is used even if the formal argument had a default expression.

See the discussion in issue #15628.

Resolves #15628.

Reviewed by @vasslitvinov - thanks!

  • [x] full local futures testing

Modified Files:
A test/arrays/ferguson/semantic-examples/9-issue-15628.chpl
A test/arrays/ferguson/semantic-examples/9-issue-15628.good
A test/arrays/intents/in/default-value-linkage-more.chpl
A test/arrays/intents/in/default-value-linkage-more.good
M compiler/resolution/wrappers.cpp
M test/arrays/intents/in/default-value-linkage.chpl
M test/arrays/intents/in/default-value-linkage.good
M test/classes/bradc/arrayInClass/overrideDefaultArr.good

Compare: https://github.com/chapel-lang/chapel/compare/2d03046297c9...72cefe145cd2