implements PR015

This commit is contained in:
2026-03-24 13:42:21 +00:00
parent 4f32913577
commit 8d8c3dc180
10 changed files with 132 additions and 141 deletions
@@ -1,44 +0,0 @@
# PR-013 - PBS Unresolved Import Diagnostics
## Briefing
Import resolution currently ignores missing target modules in frontend linking validation. This PR enforces deterministic diagnostics for unresolved module imports and unresolved imported symbols.
## Motivation
Silent import misses break the diagnostics contract and defer user-actionable errors.
## Target
- Module import validation in `PbsModuleVisibilityValidator`.
- Linking diagnostic coverage for import failures.
## Scope
- Emit errors for missing target module references.
- Keep existing public-symbol checks.
- Preserve deterministic, source-first attribution.
## Method
- Extend import validation to detect absent target modules.
- Report diagnostics on the importing site.
- Keep related-span behavior where applicable.
## Acceptance Criteria
- Importing a non-existent module always emits deterministic linking/import diagnostic.
- Importing a non-public symbol still emits existing diagnostic.
- Diagnostic attribution points to import site.
- No silent pass for unresolved imports remains.
## Tests
- Add tests for missing module import.
- Add tests for missing symbol import in existing module.
- Verify phase and diagnostic code stability.
## Non-Goals
- Full manifest/dependency resolver redesign.
- Loader/runtime capability checks.
@@ -1,42 +0,0 @@
# PR-014 - PBS Switch Wildcard Rule Enforcement
## Briefing
Switch semantics do not currently enforce all wildcard constraints. This PR enforces: at most one wildcard arm, and rejection of mixed `default` and `_` in the same switch.
## Motivation
Wildcard ambiguity weakens deterministic static semantics and conformance.
## Target
- Switch expression semantic validation in flow analyzer.
- Required static diagnostics for wildcard rule violations.
## Scope
- Enforce wildcard-count and wildcard-mixing rules.
- Preserve existing selector/type compatibility checks.
## Method
- Track wildcard token form used per switch arm.
- Emit diagnostics for duplicate wildcard and mixed wildcard spellings.
- Keep existing exhaustiveness behavior.
## Acceptance Criteria
- Two wildcard arms are rejected deterministically.
- `default` + `_` in one switch is rejected deterministically.
- Existing duplicate-pattern logic for non-wildcards remains unchanged.
## Tests
- Add tests for duplicate wildcard arms.
- Add tests for mixed `default`/`_` arms.
- Run semantic control-flow suite.
## Non-Goals
- New switch syntax.
- Runtime switch lowering changes.
@@ -1,43 +0,0 @@
# 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.