prometeu-studio/docs/pbs/pull-requests/PR-019-pbs-non-unit-fallthrough-diagnostics.md
2026-03-24 13:42:21 +00:00

43 lines
1.2 KiB
Markdown

# PR-019 - PBS Non-Unit Fallthrough Diagnostics
## Briefing
The frontend does not currently reject fallthrough of plain non-unit functions and `result` functions at end-of-body paths. This PR adds control-flow completion checks.
## Motivation
Return-surface obligations are normative and must be statically enforced.
## Target
- Callable body completion validation for function/method/ctor contexts.
## Scope
- Reject plain non-unit callable bodies that may complete without explicit return.
- Reject `result<E>` callable bodies that may complete without explicit return.
- Preserve existing unit and optional fallthrough behavior.
## Method
- Add path-completion analysis over statement/block graph.
- Integrate with existing flow body analyzer.
- Emit deterministic diagnostics with stable code/phase.
## Acceptance Criteria
- Possible fallthrough on plain non-unit callable is rejected.
- Possible fallthrough on `result<E>` callable is rejected.
- `void` and `optional` callable fallthrough behavior remains valid.
## Tests
- Add positive/negative control-flow completion fixtures.
- Cover nested `if`/`switch`/loop interactions.
- Run full flow semantics suite.
## Non-Goals
- Dataflow-based optimization.
- Runtime control-flow instrumentation.