implements PR019
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
# PR-018 - PBS Result Flow (ok/err/handle) Rule Enforcement
|
||||
|
||||
## Briefing
|
||||
|
||||
Result-flow rules are only partially enforced. This PR enforces allowed positions for `ok/err`, error-label validation, and `handle` arm terminal form requirements.
|
||||
|
||||
## Motivation
|
||||
|
||||
Result-flow constructs are normative control-flow surfaces and must not behave as unconstrained expressions.
|
||||
|
||||
## Target
|
||||
|
||||
- `ok(...)` and `err(...)` validation in return-flow contexts.
|
||||
- `handle` semantic validation, including terminal form of block arms.
|
||||
|
||||
## Scope
|
||||
|
||||
- Restrict `ok/err` to allowed result-flow positions.
|
||||
- Validate `err(E.case)` against declared error type.
|
||||
- In `handle` block arms, enforce terminal `ok(payload)` or `err(E2.case)`.
|
||||
|
||||
## Method
|
||||
|
||||
- Add expression-use/context flags for result-flow forms.
|
||||
- Add dedicated diagnostics for invalid placement and invalid error labels.
|
||||
- Add terminal-check pass for handle block arms.
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
- `ok/err` outside allowed positions are rejected deterministically.
|
||||
- `return ok/err` validates declared `result<E>` contract.
|
||||
- `handle` block arms violating terminal rules are rejected deterministically.
|
||||
- Existing propagate (`!`) and handle exhaustiveness checks remain stable.
|
||||
|
||||
## Tests
|
||||
|
||||
- Add positive and negative fixtures for `return ok/err`.
|
||||
- Add invalid-position tests for `ok/err` as ordinary expression.
|
||||
- Add `handle` arm terminal-form tests.
|
||||
|
||||
## Non-Goals
|
||||
|
||||
- New result syntax.
|
||||
- Runtime trap policy changes.
|
||||
@@ -1,42 +0,0 @@
|
||||
# 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.
|
||||
Reference in New Issue
Block a user