Closed zerbina closed 2 months ago
/merge
Merge requested by: @saem
Contents after the first section break of the PR description has been removed and preserved below:
## Notes for Reviewers * the unnecessary error is not ideal, but better than a crash
Summary
Fix a compiler crash when passing the name of a procedure with an error as an argument to another routine.
Details
Overloadable and overloaded procedure symbols forewent the
nkError
wrapping done bysemSym
, thus not preventing instantiation or later inspection bysempass2
, crashing the compiler with anIndexDefect
on attempting to access the symbol's AST.Non-overloaded procedure symbols can be passed to
semSym
directly, which takes care of the wrapping. To handle overloaded symbols,sigmatch.paramTypesMatch
passes the picked symbol tosemExpr
first, which subsequently callssemSym
, also marking the symbols as used.The problem with using
semExpr
inparamTypesMatch
is that the returnednkError
currently dismisses the overload, resulting in an unnecessary "type mismatch" compiler error (withnimsuggest
,check
, etc.).Fixes https://github.com/nim-works/nimskull/issues/1384. Fixes https://github.com/nim-works/nimskull/issues/1442.