1.2 KiB
1.2 KiB
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
thisexpression analysis.Selftype-surface analysis in declarations.- Error catalog and deterministic diagnostics.
Scope
- Reject
thisoutside struct method, service method, and ctor bodies. - Reject
Selfoutside struct/service method declarations and ctors.
Method
- Add callable-context metadata into flow/type validation.
- Emit dedicated diagnostics for invalid
thisand invalidSelfusage. - Keep valid owner contexts unchanged.
Acceptance Criteria
- Invalid
thisusage emits deterministic static diagnostic. - Invalid
Selfusage emits deterministic static diagnostic. - Valid struct/service/ctor contexts remain accepted.
Tests
- Add positive tests for valid
this/Selfcontexts. - Add negative tests for top-level functions and unrelated declarations.
- Run declaration + flow semantic suites.
Non-Goals
- Introducing new receiver features.
- Altering
Selfsyntax.