[Chapel Merge] Dyno: resolve expression-level conditions and shor

Branch: refs/heads/main
Revision: 5dd366f
Author: DanilaFe
Link: Unavailable
Log Message:

Merge pull request #20345 from DanilaFe/short-circuit-cond

Dyno: resolve expression-level conditions and short-circuit all conditions

When treated like a generic AstNode, the Condition node
does not get assigned a QualifiedType (much like Block and similar).
However, Condition should have a type when used as an expression,
such as in the following case (adapted from ChapelRange.range).

var x : if someCondition then oneType else anotherType;

In this case, we want x to be of type given by either oneType
or anotherType, and not Unknown (what it is at present). To this
end, it's necessary to unwrap the statements within both the
then and else blocks, and propagate their type up to the whole
condition. This PR also adds short-circuiting for conditions (if the
condition is known, only the appropriate branch is resolved)

Reviewed by @benharsh - thanks!

TESTING

  • Paratest, just in case :slight_smile:

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

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

M compiler/dyno/lib/resolution/Resolver.cpp
M compiler/dyno/lib/resolution/Resolver.h
M compiler/dyno/test/resolution/CMakeLists.txt
M compiler/dyno/test/resolution/testEnums.cpp
M compiler/dyno/test/resolution/testParamIf.cpp

Compare: https://github.com/chapel-lang/chapel/compare/ae4afd50b4bf...5dd366f628d4