Adds (If <predicate> <body> <alternative>) expression support, as well as gated logic, via the (If <predicated> <body>) variant.
Details
The body only variants are always treated as unit type expressions, while the exhaustive variants can be expressions of any variety so long as the body and alternative branch types match (the same or subtype).
Implemented If, along with a variety of tests for various failure scenarios. Additionally, added the ability to provide extra message info to the unreachable routine, this is useful for debugging.
Notes for Reviews
~I just realized that I can use Return to test the Void cases, so I'll add tests accordingly~
I can't because we don't support statement lists just yet
I'm not too sure about the quality of error messages, but maybe that doesn't matter?
I still don't have a good feel for code style as I'm getting used to the codebase
Summary
Adds
(If <predicate> <body> <alternative>)
expression support, as well as gated logic, via the(If <predicated> <body>)
variant.Details
The
body
only variants are always treated asunit
type expressions, while the exhaustive variants can be expressions of any variety so long as thebody
andalternative
branch types match (the same or subtype).Implemented
If
, along with a variety of tests for various failure scenarios. Additionally, added the ability to provide extra message info to theunreachable
routine, this is useful for debugging.Notes for Reviews
Return
to test theVoid
cases, so I'll add tests accordingly~