Repository navigation
-mm=own: reverse and sort move string elements by copy - #48
Merged
Merged
Conversation
reverse reads the element it swaps into a `let`, as sort's `temp` did: a `const` borrows the slot overwritten next. sort no longer assigns its optional comparator a default - a callback parameter that is assigned is one -mm=own knows nothing about, so a call of it with two elements was a use of them after a call that may release them; it gives a selectionSort helper the comparator or the default. Needs the compiler's copy of a string read out of a parameter the result borrows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Under
-mm=own,reverseandsortover strings failed.reverse: it reads the element it swaps into alet, assort'stempalready did. Aconstborrows the slot that the next line overwrites. Aletstarts from a copy of a string; for a number it changes nothing.sort: it no longer assigns its optional comparator parameter a default.callbackfn(this[i], this[j])was a use of the two elements after a call that may release them.sortnow gives aselectionSorthelper either the comparator it was given or the default.The other models behave as before.
Depends on ASDAlexander77/TypeScriptCompiler#702: a string read out of the parameter the result borrows is copied into a place. Merge that first.
Tests
array_copyWithin,owning_copies,array_reverse,array_sort,string_localeCompare), with no new failures.sort/reverseover class instances under own.🤖 Generated with Claude Code