[Chapel Merge] compiler/next: Convert more internal modules to uA

Branch: refs/heads/main
Revision: 775dce1
Author: dlongnecke-cray
Link: compiler/next: Convert more internal modules to uAST by dlongnecke-cray · Pull Request #18721 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #18721 from dlongnecke-cray/next-convert-more-internal-modules

compiler/next: Convert more internal modules to uAST (#18721)

Convert more internal modules to uAST by working through a
combination of bugs and TODOs at parse/conversion time.

Changes follow:

Implement the conversion routine for the foreach loop, for the
statement level only. It looks like the grammar does not support
expression level foreach loops yet.

Implement the conversion routine for label statements.

Adjust expression-level try nodes to use a different builder that
generates a PRIM_TRY call instead of a block.

Add special handling to convert the call foo.bytes(). The previous
approach generated one too many calls.

Adjust one of the rules for parsing a bracket loop to properly
consume the loop iterand instead of the body twice. This fixed
a double free bug.

Properly reset the parser visibility level after parsing a use or
import statement.

Handle primary methods and leave a TODO to error if the receiver
for a primary method has a type expression.

Add special handling when converting extern types and config types.

Add another constructor for astlocMarker that takes a Location.
Care should be taken when pinning on chpl::Location over
chpl::ID as the location can grow stale when queries are rerun.
A better strategy could be used here in the future.

Set a global error handler for the compiler library context in
the uASTParseFile function. For now, it simply dumps any parse
errors that are emitted with calls to USR_FATAL_CONT and
USR_PRINT. We may want to make this error handler more robust or
move it to another source location in the future.

Attach visibility to Symbol generated for Variable. We will
need to attach it to other generated symbols as future work.

Reviewed by @mppf, @aconsroe-hpe. Thanks!


  • [x] ALL on linux64 when COMM=none (check that chpl works)
  • [x] All hellos with --compiler-library-parser
  • [x] All primers with --compiler-library-parser

Signed-off-by: David Longnecker dlongnecke-cray@users.noreply.github.com

Modified Files:
M compiler/include/astlocs.h

M compiler/next/include/chpl/uast/Loop.h
M compiler/next/lib/parsing/ParserContextImpl.h
M compiler/next/lib/parsing/bison-chpl-lib.cpp
M compiler/next/lib/parsing/bison-chpl-lib.h
M compiler/next/lib/parsing/chpl.ypp
M compiler/next/lib/uast/AggregateDecl.cpp
M compiler/parser/parser.cpp
M compiler/passes/convert-uast.cpp
M compiler/util/astlocs.cpp

Compare: https://github.com/chapel-lang/chapel/compare/fd5c10ce62e7...775dce1d2b93