Check return expressions against the function's declared return type #59
Labels
No labels
bug
design
epic
risk
user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jacksonopp/twill#59
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Type-check Expr::Return's optional value against the enclosing function's declared return type (or Unit when the value is absent), extending #3's return-type checking to early returns, not just a function body's trailing expression.
Resolved in #78: a new
check_returnchecksExpr::Return's optional value against the enclosing function's declared return type (Scope::current_fn_return, set/restored aroundcheck_fn's body check), with barereturnchecked againstUnit. ReusesReturnTypeMismatch/NoTypeProduced, mirrors the-> typecarve-out, and defersreturn-outside-a-function same asbreak-outside-a-loop.