[Chapel Merge] compiler/next: parse modules on use/import

Branch: refs/heads/main
Revision: fcbd194
Author: mppf
Link: compiler/next: parse modules on use/import by mppf · Pull Request #19134 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19134 from mppf/next-parse-imported

compiler/next: parse modules on use/import

Resolves https://github.com/Cray/chapel-private/issues/2637

This PR adjusts the compiler/next code to handle parsing a module on a
use/import.

  • adds a settable module search path (moduleSearchPath /
    setModuleSearchPath) to parsing-queries.h
  • to avoid polluting the unique strings map with pathname components,
    adjusted fileText, setFileText to accept the path as a
    std::string
  • added hasFileText for use when testing to see if a file at a
    particular path is already known to the compiler from setFileText
  • getToplevelModule can now find modules using the module search path.
    When it does so, it checks if setFileText has already indicated the
    file at a particular path (by calling hasFileText); if not it uses a
    new file system call to check if the file exists at the various module
    path locations. The hasFileText enables C++ tests of the use/import
    parsing to work without storing anything in the filesystem.
  • Moved the implementation of Context::setFilePathForModuleID closer
    to the related functions and added Context::hasCurrentResultForQuery
    for use in hasFileText and similar.

Reviewed by @dlongnecke-cray - thanks!

  • [x] full local testing

    Modified Files:
    M compiler/next/include/chpl/parsing/parsing-queries.h
    M compiler/next/include/chpl/queries/Context.h
    M compiler/next/include/chpl/queries/query-impl.h
    M compiler/next/include/chpl/util/filesystem.h
    M compiler/next/lib/parsing/parsing-queries.cpp
    M compiler/next/lib/queries/Context.cpp
    M compiler/next/lib/util/filesystem.cpp
    M compiler/next/test/parsing/testParsingQueries.cpp
    M compiler/next/test/resolution/testInteractive.cpp
    M compiler/next/test/resolution/testScopeResolve.cpp

    Compare: Comparing 2005de5b2293...fcbd194466bc · chapel-lang/chapel · GitHub