[codex] Implement PR11.10c built-in map#197
Merged
berkeleynerd merged 2 commits intoberkeleynerd:mainfrom Apr 3, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Implements the PR11.10c “built-in map” surface by adding map of (K, V) as a first-class source type constructor and lowering map operations to the existing growable-array-of-(K, V) tuple machinery, with accompanying docs and test/proof coverage.
Changes:
- Add parsing, AST emission/schema, and type resolution for
map of (K, V). - Implement contextual map builtins (
contains,get,set,remove) via resolver validation + desugaring/lowering. - Add positive/negative/interface/build tests and wire them into the test + proof harnesses; update docs/spec.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/positive/pr1110c_map_basics.safe | Positive coverage for default-empty maps, iteration over (K,V) tuples, and basic map ops. |
| tests/negative/neg_pr1110c_set_non_map.safe | Reject set when first arg isn’t a map. |
| tests/negative/neg_pr1110c_set_constant.safe | Reject set when the map target is not writable. |
| tests/negative/neg_pr1110c_remove_stmt.safe | Reject remove used as a statement (must be expression). |
| tests/negative/neg_pr1110c_remove_constant.safe | Reject remove when the map target is not writable. |
| tests/negative/neg_pr1110c_map_value_mismatch.safe | Reject set with a value type mismatch. |
| tests/negative/neg_pr1110c_map_key_mismatch.safe | Reject get with a key type mismatch. |
| tests/negative/neg_pr1110c_map_bad_key.safe | Reject disallowed map key types. |
| tests/interfaces/provider_map.safe | Interface test provider exporting map-valued APIs. |
| tests/interfaces/client_map.safe | Interface test client consuming provider’s map API. |
| tests/build/pr1110c_map_build.safe | Build/run coverage for update + remove semantics and .length. |
| tests/build/pr1110c_map_string_build.safe | Build/run coverage for string-key/string-value maps. |
| tests/build/pr1110c_map_list_build.safe | Build/run coverage for maps with container (list) values. |
| spec/08-syntax-summary.md | Syntax summary updates for map_type_spec and builtin call admission rules. |
| scripts/run_tests.py | Registers new positive/interface/build test cases for maps. |
| scripts/run_proofs.py | Adds PR11.10c proof checkpoint fixture group execution and summary. |
| scripts/_lib/proof_inventory.py | Adds PR11.10c checkpoint fixture manifest and includes it in coverage roots. |
| docs/tutorial.md | Tutorial section documenting the new map surface and examples. |
| docs/PR11.x-series-proposed.md | PR11.10c spec updates (decisions/scope/notes) for map wedge. |
| compiler/ast_schema.json | Extends AST schema with MapTypeSpec and allows it in relevant type positions. |
| compiler_impl/src/safe_frontend-check_parse.adb | Adds parser support + internal naming for map of (K, V) type specs. |
| compiler_impl/src/safe_frontend-check_model.ads | Adds Type_Spec_Map and key/value fields to the frontend type-spec model. |
| compiler_impl/src/safe_frontend-check_emit.adb | Emits MapTypeSpec nodes in AST JSON output. |
| compiler_impl/src/safe_frontend-check_resolve.adb | Resolves map types to growable arrays of 2-tuples; validates map builtins; desugars/lowerings for map ops. |
| compiler_impl/src/safe_frontend-ada_emit.adb | Updates synthetic-type collection / type lookup paths needed for new map/tuple helper emission. |
💡 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
Implements
PR11.10cas the minimal built-inmap of (K, V)wedge.This adds:
map of (K, V)as a source type constructorcontains(m, key)get(m, key)set(m, key, value)remove(m, key)Why
This is the next container slice after
PR11.10b. It establishes the first admitted map surface without introducing a second container runtime or method syntax.The implementation keeps maps as an unsorted growable sequence of
(K, V)entries with linear lookup and explicitly unspecified iteration order.Impact
User-facing changes:
map of (K, V)is now acceptedsetmutates a writable map in statement positiongetandremovereturnoptional Vfor entry of miterates(K, V)tuplesCompiler/runtime impact:
Validation
Validated in the implementation checkout before publishing this clean branch:
cd compiler_impl && alr buildpython3 scripts/run_tests.py->717 passed, 1 skipped, 0 failedpython3 scripts/run_samples.py->19 passed, 0 failedpython3 scripts/run_proofs.py->176 proved, 0 failedThe branch published here was recreated from refreshed
upstream/mainand the PR11.10c patch applied cleanly onto that base.