Repository navigation
Expand read-only Mapping values as associative arrays - #167
Open
anishpentyala wants to merge 2 commits into
Open
anishpentyala wants to merge 2 commits into
anishpentyala wants to merge 2 commits into
Conversation
This branch has not been deployed
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.
Problem
Nested read-only mappings satisfy
VariableValue's existingMapping[str, ScalarVariableValue]annotation, but runtime detection only recognizesdictandMutableMapping. As a result, aMappingProxyTypeor a custom read-onlyMappingis expanded as its quoted Python representation rather than as an associative value.For example:
Change
Use
collections.abc.Mappingindict_test. The existing associative expansion paths only read the mapping, so they do not need the stronger mutable interface.The regression tests cover standard
MappingProxyTypeand a custom read-onlyMappingacross all eight operators, with and without explode. They also check sorted-key behavior, no mutation, quoted-key/value parity with dictionaries, and that scalar/list/list-of-pairs values are not reclassified.This follows the outer-mapping typing work in #130, but fixes nested associative value detection at runtime. It does not change the existing empty-collection behavior discussed in #164 or attempt to fix unrelated prefix/escaping behavior.
Validation
Hosted checks remain separate from these local results.