check if/else expressions #63
Loading…
Reference in a new issue
No description provided.
Delete branch "us54/check-if-else"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #54.
Type-checks
Expr::If: condition must beBool(reportsInvalidConditionalotherwise), both branches must agree on their result type whenelseis present (reports the newMismatchedElsediagnostic otherwise, resolving to thethenbranch's type), and the expression resolves toUnitwhenelseis absent, mirroringExpr::Block's trailing-expr-less case.Test plan
cargo test -p twill-check(new unit tests for matching branches, no-else, non-Boolcond, mismatched branches, and a failing else branch not double-reporting)