44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
# PR-015 - PBS this/Self Context Validation
|
|
|
|
## Briefing
|
|
|
|
The frontend accepts `this` and `Self` outside allowed contexts without required diagnostics. This PR adds explicit static checks for invalid usage.
|
|
|
|
## Motivation
|
|
|
|
Context-free acceptance of `this`/`Self` is non-conformant and creates type ambiguity.
|
|
|
|
## Target
|
|
|
|
- `this` expression analysis.
|
|
- `Self` type-surface analysis in declarations.
|
|
- Error catalog and deterministic diagnostics.
|
|
|
|
## Scope
|
|
|
|
- Reject `this` outside struct method, service method, and ctor bodies.
|
|
- Reject `Self` outside struct/service method declarations and ctors.
|
|
|
|
## Method
|
|
|
|
- Add callable-context metadata into flow/type validation.
|
|
- Emit dedicated diagnostics for invalid `this` and invalid `Self` usage.
|
|
- Keep valid owner contexts unchanged.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- Invalid `this` usage emits deterministic static diagnostic.
|
|
- Invalid `Self` usage emits deterministic static diagnostic.
|
|
- Valid struct/service/ctor contexts remain accepted.
|
|
|
|
## Tests
|
|
|
|
- Add positive tests for valid `this`/`Self` contexts.
|
|
- Add negative tests for top-level functions and unrelated declarations.
|
|
- Run declaration + flow semantic suites.
|
|
|
|
## Non-Goals
|
|
|
|
- Introducing new receiver features.
|
|
- Altering `Self` syntax.
|