Branch: refs/heads/main
Revision: 0281aed4cac6fe8e87f37248fd017177202a811c
Author: DanilaFe
Link: Dyno/CLS: fix bugs in resolution affecting CLS with Mason by DanilaFe · Pull Request #28482 · chapel-lang/chapel · GitHub
Log Message:
Dyno/CLS: fix bugs in resolution affecting CLS with Mason (#28482)
This PR fixes a few bugs that affected resolving the Mason codebase. In
particular, these bugs arose when being more proactive about resolving
the code (following instantiations etc.); they aren't picked up in a
normal testInteractive run.
Anyhow, the bugs were as follows:
MultiDecl::childrenwas used to iterate the sub-declarations in a
multi-decl instead ofMultiDecl::decls. Thechildrenmethod is
inherited fromAstNode, and can include other AST nodes such as
attribute groups. The code should've been usingdecls, which filters
for declarations only.- Reported mismatched actual indices exceeded the bounds of a
CallInfo
because internally, the resolution machinery switched to trying to
resolve a method call, inserting athisformal. To fix this, adjust
CallInfoto track whether the implicitthiswas added, and adjust
the machinery that reports the actual index to consider this information
to return an actual index into the originalCallInfo, rather than the
modified one. - In a similar vein, error reporting logic with
printRejectedCandidatesforNoMatchingCandidateserror reporting
used aCallInfo's actual index to index into aCall::actualslist.
SinceCall::actualsreturns only the arguments between the(and)
of the call, whileCallInfoincludes thethisformal which
syntactically occurs before the(. To fix this, adjust the code to
subtract one from the actual index when the call is an explicit method
call before indexing.
While there, notice that we don't respect the various pragma "error mode..." pragmas for nested modules, so adjust the code to work with
that.
Reviewed by @benharsh -- thanks!
Testing
- Dyno tests
- CLS tests
Diff:
M frontend/include/chpl/resolution/resolution-types.h
M frontend/lib/resolution/Resolver.cpp
M frontend/lib/resolution/resolution-error-classes-list.cpp
M frontend/lib/resolution/resolution-queries.cpp
M frontend/lib/resolution/resolution-types.cpp
M frontend/lib/resolution/try-catch-analysis.cpp
M frontend/test/resolution/testResolve.cpp
M tools/chapel-py/src/chapel/lsp/init.py
https://github.com/chapel-lang/chapel/pull/28482.diff