[Chapel Merge] dyno: scope resolve task-intents

Branch: refs/heads/main
Revision: 4ede120
Author: benharsh
Link: dyno: scope resolve task-intents by benharsh · Pull Request #20470 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #20470 from benharsh/dyno-task-intents

dyno: scope resolve task-intents

This PR implements scope resolution of task-intents in dyno (including reduce-intents).

In order to support this effort a new uAST node, ReduceIntent, is introduced to distinguish reduce-intents from reduce-expressions. Like the TaskVar uAST node, ReduceIntent is derived from NamedDecl. This approach is necessary because the accumulation state of a reduction can be of a different type than the shadowed outer variable.

Scope-resolution of a task-intent involves registering the task-intent as a declaration, and involves scope-resolving the shadowed outer variable by name. Registering the task-intent as a declaration is as simple as updating the GatherDecls visitor to step inside WithClause nodes. Scope-resolving the shadowed outer variable must be done using the scope preceding the loop-statement. The scope-resolved ID is stored in the task-intent's ResolvedExpression.

This PR also implements some basic type-resolution of task-intents (but not reduce-intents) by using the outer variable's type as the task-intent's type. This is overly simplistic, particularly for in-intents, but is a small step forward nonetheless.

Finally, the scope-resolution results are used in convert-uast to get a number of tests passing with -dyno, including the forallLoops primer.

This PR also includes a small change to the printed output for an OpCall, which now includes the operation being called (e.g. "OpCall +").

[reviewed-by @dlongnecke-cray]

Modified Files:
A compiler/dyno/include/chpl/uast/ReduceIntent.h

A compiler/dyno/lib/uast/ReduceIntent.cpp
A compiler/dyno/test/resolution/testTaskIntents.cpp
M compiler/dyno/include/chpl/uast/all-uast.h
M compiler/dyno/include/chpl/uast/uast-classes-list.h
M compiler/dyno/lib/parsing/ParserContext.h
M compiler/dyno/lib/parsing/ParserContextImpl.h
M compiler/dyno/lib/parsing/bison-chpl-lib.cpp
M compiler/dyno/lib/parsing/chpl.ypp
M compiler/dyno/lib/resolution/Resolver.cpp
M compiler/dyno/lib/resolution/Resolver.h
M compiler/dyno/lib/resolution/scope-queries.cpp
M compiler/dyno/lib/uast/AstNode.cpp
M compiler/dyno/lib/uast/CMakeLists.txt
M compiler/dyno/lib/uast/Makefile.include
M compiler/dyno/lib/uast/chpl-syntax-printer.cpp
M compiler/dyno/test/resolution/CMakeLists.txt
M compiler/passes/convert-uast.cpp

Compare: https://github.com/chapel-lang/chapel/compare/0b3ccfcc3228...4ede1205ff11