-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[WIP] Dictionary/Set cumulative test PR #19586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
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
The mutation count will allow us to recognize and trap on invalid indices more reliably. (However, it won’t be foolproof — some invalid indices may pass through the checks.) - Change _scale to Int8 to make space for an extra Int32 without enlarging the storage header. - Add an _age field inside the new gap. - Initialize the age to a scrambled version of the storage address. - Generate a new counter for every newly allocated storage instance, except for identical copy-on-write copies. - Increment the mutation counter after every removal.
(For symmetry with Dictionary, which already has this check.)
Also add static_assert for Set/Dictionary storage header size.
Set and Dictionary will start using this shortly as their native index types.
@swift-ci please test source compatibility |
…-level indices Native sets and (especially!) native dictionaries must support indexing with Cocoa indices — indices must be preserved when a Cocoa set/dictionary is converted to native. This is especially the case for Dictionaries that were converted because of a mutation restricted to values — such as those done through the Values view.
…sages Capital Index seems too nitpicky, somehow
This makes it a little easier to follow validation logic.
Like before, allow the use of Cocoa indices to access native sets/dictionaries, but approximate the same mutation count-based check as we do for native indices. - Ensure that native collections that were converted from Cocoa have an age generated from the address of the original Cocoa object. - To get the age of a Cocoa index, regenerate one from the object embedded in it. - Compare self.age to index.age and trap if it doesn’t match.
Affected operations: subscript(index:) remove(at:) Note that index(after:) is intentionally not on this list.
…tionaries Affected operations: subscript(index:) keys.subscript(index:) values.subscript(index:) (setter and _modify) remove(at:) swapAt(_:, _:) Note that index(after:) is intentionally not on this list.
…an internal error
@swift-ci please test |
Build failed |
Build failed |
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.
This is just a test, consisting of the sum of the following PRs:
They all seem to trigger a source compatibility failure within the same project, but none of these failures seem reproducible locally.