[Chapel Merge] Dyno: enable module scope checks

Branch: refs/heads/main
Revision: a45af4e5eb4dd23fc23839d3598fa85ac985a919
Author: DanilaFe
Link: Dyno: enable module scope checks by DanilaFe · Pull Request #27203 · chapel-lang/chapel · GitHub
Log Message:
Dyno: enable module scope checks (#27203)

Best reviewed commit-by-commit.

Previously, call-init-deinit.cpp had the following comment:

// TODO: Run this for module initializer code as well. Currently if enabled,
// it breaks a large number of dyno tests that have module-initializer code
// containing things we can't resolve default-init for yet, such as
// fully-defaulted generic types. Either adjust the tests to expect the errors
// for unsupported code, or add the support, then enable this on modules.
if (!resolver.symbol->isModule()) {

It seems like we are far enough along that module-level variables don't
break things in any cases I've tried. So, re-enable these steps. Lots of
tests were relying on them not being invoked, so update those. While
there, fix a number of bugs that came up. See each individual commit in
this PR.

Reviewed by @benharsh -- thanks!

Testing

  • dyno tests
  • spectests and primers with --dyno-resolve-only ("breaks" one
    test by emitting an additional, correct, error message)
  • paratest

Compare: Comparing 4779636a6775394bc2a0058f2760b6e4202c137a...b6e1ca9d01287a6fb3f94c879ddf35354b243cbf · chapel-lang/chapel · GitHub

Diff:
M frontend/lib/resolution/InitResolver.cpp
M frontend/lib/resolution/Resolver.cpp
M frontend/lib/resolution/Resolver.h
M frontend/lib/resolution/VarScopeVisitor.cpp
M frontend/lib/resolution/VarScopeVisitor.h
M frontend/lib/resolution/call-init-deinit.cpp
M frontend/lib/resolution/copy-elision.cpp
M frontend/lib/resolution/default-functions.cpp
M frontend/lib/resolution/resolution-queries.cpp
M frontend/lib/resolution/split-init.cpp
M frontend/test/ErrorGuard.h
M frontend/test/resolution/testCast.cpp
M frontend/test/resolution/testDeprecationUnstable.cpp
M frontend/test/resolution/testEnums.cpp
M frontend/test/resolution/testForwarding.cpp
M frontend/test/resolution/testGenericDefaults.cpp
M frontend/test/resolution/testHeapBuffer.cpp
M frontend/test/resolution/testLoopIndexVars.cpp
M frontend/test/resolution/testMethodCalls.cpp
M frontend/test/resolution/testMultiDecl.cpp
M frontend/test/resolution/testNew.cpp
M frontend/test/resolution/testOpaqueExternTypes.cpp
M frontend/test/resolution/testOperatorOverloads.cpp
M frontend/test/resolution/testResolve.cpp
M frontend/test/resolution/testResolverVerboseErrors.cpp
M frontend/test/resolution/testRuntimePrimitives.cpp
https://github.com/chapel-lang/chapel/pull/27203.diff