[Chapel Merge] dyno: only check one branch of compile-time known

Branch: refs/heads/main
Revision: 9c35e58
Author: DanilaFe
Link: Unavailable
Log Message:

Merge pull request #20298 from DanilaFe/param-if

dyno: only check one branch of compile-time known conditional when finding returns

Many type-valued functions in the Chapel standard library use
if-statements in which the condition is a boolean param. Prior to this
commit, the resolver would search both branches of such if-statements to
determine a function's return type, which stood in the way of resolving
type expressions that call these functions. With this change,
only the one branch corresponding to the condition's param value will
be searched, which is a lot of the time enough to figure out the
exact type returned from a function.

Reviewed by @benharsh - thanks!

Testing:

  • paratest

Signed-off-by: Danila Fedorin daniel.fedorin@hpe.com

Modified Files:
A compiler/dyno/test/resolution/testParamIf.cpp

M compiler/dyno/lib/resolution/resolution-queries.cpp
M compiler/dyno/test/resolution/CMakeLists.txt

Compare: https://github.com/chapel-lang/chapel/compare/1b7de991734d...9c35e581c64a