[Chapel Merge] Report errors for improper args of 'sparse subdoma

Branch: refs/heads/main
Revision: ea9cea2
Author: vasslitvinov
Link: Report errors for improper args of 'sparse subdomain' by vasslitvinov · Pull Request #19058 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19058 from vasslitvinov/sparse-parent-dom-err

Report errors for improper args of 'sparse subdomain'

Report an error upon sparse subdomain(x) where x is a type or not a domain.

This was motivated by my writing this innocent-looking code, which used to
produce an error message that is unhelpful and reveals implementation details:

var DR = [1..3];
var SS: sparse subdomain(DR);

To enable this, move some AST building logic from the parser into the modules.

r: @lydia-duncan

Modified Files:
A test/sparse/domains/parentNotDomainError.chpl

A test/sparse/domains/parentNotDomainError.good
A test/sparse/domains/parentNotValueError.chpl
A test/sparse/domains/parentNotValueError.good
M compiler/include/bison-chapel.h
M compiler/include/flex-chapel.h
M compiler/parser/bison-chapel.cpp
M compiler/parser/chapel.ypp
M compiler/parser/flex-chapel.cpp
M compiler/passes/convert-uast.cpp
M modules/internal/ChapelDomain.chpl

Compare: https://github.com/chapel-lang/chapel/compare/dc8b7e6adc73...ea9cea23b52a