Repository navigation
Reprint the key type of an array shape's unsealed type before its value type - #357
Merged
Merged
Conversation
…ue type The format-preserving printer reprints the subnodes of a node in the order of its properties, ArrayShapeUnsealedTypeNode declared the value type first. An unchanged ...<string, int> was printed as ...<string, intstring, int>. Amp-Thread-ID: https://ampcode.com/threads/T-01a22c96-9e21-771f-9a29-4627539ba301
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.
The format-preserving printer reprints the subnodes of a node in the order of its properties, and
ArrayShapeUnsealedTypeNodedeclared$valueTypebefore$keyType. Reprinting an unchangedarray{a: int, ...<string, int>}producedarray{a: int, ...<string, intstring, int>}, which does not parse. The same happened when only the key or the value type changed.The fix declares
$keyTypefirst, in the order of the source. The constructor signature is unchanged. Tests for an unchanged keyed unsealed type, with and without other items, and for a changed key type and a changed value type are added todataPrintFormatPreserving.