[Chapel Merge] Improve error for invalid `ref` task intents on `coforall` etc

Branch: refs/heads/main
Revision: 3c872fc2906ff5ad326c8f6a369db44301562c2a
Author: DanilaFe
Link: Improve error for invalid `ref` task intents on `coforall` etc by DanilaFe · Pull Request #27919 · chapel-lang/chapel · GitHub
Log Message:
Improve error for invalid ref task intents on coforall etc (#27919)

Closes [Bug]: undefined outer variable in task parallel block causes internal error · Issue #25639 · chapel-lang/chapel · GitHub.

The error no longer is internal on main, but used to print a not-very
specific "first use this function" warning. This is because task intents
for forall etc are handled differently than task intents for other
tasking constructs. In this PR, add a check for the "first use this
function" error to adjust the error message to match the forall case.
This seemed most appropriate since trying to shoehorn the handling for
cobegin etc into the same logic as forall might well convolute the
code more (they are different constructs!), and since we can easily
issue a more specific error message here.

Testing

  • paratest

Reviewed by @jabraham17 -- thanks!

Compare: Comparing 1114b9981f6e701efbcece6e87f43ec4eb28319e...508e975335a7fdbe75945f93a680a2f3141c2723 · chapel-lang/chapel · GitHub

Diff:
M compiler/include/scopeResolve.h
M compiler/passes/normalize.cpp
M compiler/passes/scopeResolve.cpp
A test/parallel/taskPar/taskIntents/undefinedOuterVar-begin.chpl
A test/parallel/taskPar/taskIntents/undefinedOuterVar-begin.good
A test/parallel/taskPar/taskIntents/undefinedOuterVar-cobegin.chpl
A test/parallel/taskPar/taskIntents/undefinedOuterVar-cobegin.good
A test/parallel/taskPar/taskIntents/undefinedOuterVar-coforall.chpl
A test/parallel/taskPar/taskIntents/undefinedOuterVar-coforall.good
A test/parallel/taskPar/taskIntents/undefinedOuterVar-forall.chpl
A test/parallel/taskPar/taskIntents/undefinedOuterVar-forall.good
https://github.com/chapel-lang/chapel/pull/27919.diff