You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unannotated fn with an early return value falls off the end into T.default() instead of 'missing return' (§4.10, D43) #1494
prints x then 0, no diagnostic. D43 infers i32 from return 5, and infer_unannotated_function_return_type (SemaCheck) then accepts the fall-off whenever the inferred type has a default (it only errors "return type does not implement Default").
§4.10: "If any path in the body explicitly returns a value (a return expr or a non-Unit tail expression on another branch), implicit default return does not apply — a function that demonstrably produces values elsewhere but falls off the end is reported as a missing return, not defaulted." D43: "a value on one path and fall-off on another remains §4.10's missing-return error." The annotated spelling (fn f(p: bool) -> i32:) is already "missing return" (the body_ty == ty_void branch of the declared-return check); the unannotated one substitutes i32.default().
Expected: "missing return" for the unannotated spelling too. Needs a sweep of unannotated functions that rely on it before landing.
Activity
test: an unannotated value-return-plus-fall-off body is a missing ret…