[codex] Implement PR11.11b structural interfaces#200
Merged
berkeleynerd merged 2 commits intoberkeleynerd:mainfrom Apr 4, 2026
Merged
[codex] Implement PR11.11b structural interfaces#200berkeleynerd merged 2 commits intoberkeleynerd:mainfrom
berkeleynerd merged 2 commits intoberkeleynerd:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements the PR11.11b subset of Safe structural interfaces as compile-time-only operation contracts, including parsing/AST/schema support, satisfaction checking, and specialization of local/private interface-constrained bodies into concrete clones prior to MIR emission.
Changes:
- Add
type X is interfacedeclarations with signature-only receiver members and enforce PR11.11b subset restrictions (parameter-position only, no interface objects/returns, reject public interface-constrained bodies). - Implement structural satisfaction checking and clone-based specialization of interface-constrained subprogram bodies, while ensuring templates are not lowered/emitted to MIR/Ada.
- Bump and validate emitted artifact contracts (
typed-v5,safei-v4) and add tests/docs/proof fixtures for the new surface.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/positive/pr1111b_interface_local.safe | Positive local interface + satisfaction + call syntax coverage. |
| tests/negative/neg_pr1111b_public_interface_body.safe | Reject public interface-constrained body in PR11.11b subset. |
| tests/negative/neg_pr1111b_missing_member.safe | Reject interface satisfaction when required member is missing. |
| tests/negative/neg_pr1111b_interface_return.safe | Reject interface types in return positions. |
| tests/negative/neg_pr1111b_interface_object.safe | Reject interface-typed objects (non-parameter positions). |
| tests/negative/neg_pr1111b_interface_member_no_receiver.safe | Reject interface member specs without receiver syntax. |
| tests/negative/neg_pr1111b_interface_free_call.safe | Reject interface-member calls using free-call syntax (vs method syntax). |
| tests/interfaces/provider_printable.safe | Export a public interface + concrete provider type for cross-unit tests. |
| tests/interfaces/client_printable.safe | Cross-unit satisfaction test using imported interface contract. |
| tests/interfaces/client_printable_ambiguous.safe | Cross-unit ambiguous satisfaction negative case. |
| tests/build/pr1111b_interface_builtin_build.safe | Build/run coverage for interfaces satisfied by builtin container operations. |
| spec/08-syntax-summary.md | Add grammar and syntax notes for structural interface declarations and restrictions. |
| spec/02-restrictions.md | Clarify exclusion applies to Ada interface/tagged types, not Safe structural interfaces. |
| scripts/validate_output_contracts.py | Extend contract validator for interface_members; bump typed/safei versions. |
| scripts/validate_ast_output.py | Admit InterfaceTypeDefinition node in AST validation allowlist. |
| scripts/run_tests.py | Add PR11.11b positive/build fixtures and cross-unit interface test cases. |
| scripts/run_proofs.py | Add PR11.11b checkpoint proof fixture group. |
| scripts/_lib/proof_inventory.py | Register PR11.11b checkpoint fixtures in proof inventory. |
| docs/tutorial.md | Document structural interfaces and PR11.11b subset limitations in the tutorial. |
| docs/PR11.x-series-proposed.md | Update PR11.11b proposal text to match implemented subset and behavior. |
| docs/artifact_contract.md | Bump frozen artifact formats to typed-v5 and safei-v4 and document interface_members. |
| compiler/ast_schema.json | Add InterfaceTypeDefinition AST node schema. |
| compiler_impl/src/safe_frontend-mir_model.ads | Add MIR-model structs for interface member signatures in type descriptors. |
| compiler_impl/src/safe_frontend-interfaces.adb | Parse interface_members from imported interface/type descriptors; accept safei-v4. |
| compiler_impl/src/safe_frontend-check_resolve.adb | Implement interface typing rules, satisfaction, template specialization, and template suppression. |
| compiler_impl/src/safe_frontend-check_parse.adb | Parse type ... is interface with indented signature-only members and validation. |
| compiler_impl/src/safe_frontend-check_model.ads | Add interface decl kind/members and flags for synthetic/interface-template subprograms. |
| compiler_impl/src/safe_frontend-check_lower.adb | Skip lowering interface templates to MIR graphs. |
| compiler_impl/src/safe_frontend-check_emit.adb | Emit interface AST nodes and interface_members; bump to typed-v5/safei-v4; suppress template/synthetic executables. |
| compiler_impl/src/safe_frontend-ada_emit.adb | Avoid emitting Ada for interface types and interface-template subprograms. |
| compiler_impl/README.md | Update documentation to typed-v5 / safei-v4 terminology. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
typed-v5andsafei-v4, and add tests, proofs, and docs for the shipped interface surfaceWhy
PR11.11b is the next composition milestone after method syntax. This lands named structural interfaces with zero runtime dispatch by keeping them as compile-time contracts only and lowering interface-constrained bodies away before MIR.
Validation
cd compiler_impl && alr buildpython3 scripts/run_tests.py->745 passed, 1 skipped, 0 failedpython3 scripts/run_samples.py->19 passed, 0 failedpython3 scripts/run_proofs.py->181 proved, 0 failedPR11.11b checkpoint: 2 proved, 0 failed