New Issue: Improve error messages for passing a const variable to a ref task intent

24679, "jabraham17", "Improve error messages for passing a const variable to a ref task intent", "2024-03-26T18:03:04Z"

We should be emitting an error message for passing a const array to a ref task intent. When specifying a mismatched set of task intents on a parallel construct, the compiler fails to emit an error. This is different behavior from functions, where mismatched argument intents do result in an error

const A: [1..10] int;

forall i in 1..10 with (ref A) {} // no error passing const to ref
begin with (ref A) {} // no error passing const to ref

proc foo(ref A) {}
foo(A); // error: const actual passed to ref formal

Note that all of these have empty bodies, adding any statement to these that actually does modify the array results in an error for attempting to modify a const array, but still fail to show an error for passing a const to a ref

const A: [1..10] int;

forall i in 1..10 with (ref A) { // no error passing const to ref
  A[i] = i; // error:  cannot assign to const variable
}
begin with (ref A) { // no error passing const to ref
  A = 1..10; // error: cannot assign to const variable
}

Related const array issues

However, this seems to be an issue more broadly than arrays, the following code should also have an error and fails to do so

const a: int = 1;
begin with (ref a) { // no error
  // a = 2;
}

Uncommenting the assignment in the loop gets the correct error about assigning to a const, but still no error on the task intent.