Repository navigation
fix: support creating sparse arrays from empty inputs - #28
Open
iAmMichaelConnor wants to merge 1 commit into
Open
iAmMichaelConnor wants to merge 1 commit into
iAmMichaelConnor wants to merge 1 commit into
Conversation
iAmMichaelConnor
force-pushed
the
mike/05-fix-empty-arrays
branch
from
November 2, 2026 18:16
6a6b98b to
b2d1778
Compare
create() always sorted its input keys, and `sort_advanced` cannot be compiled for an empty array, so neither array could be created without initial entries, e.g. an initially empty MutSparseArray. Skip the sort and value insertion when there are no input keys.
TomAFrench
force-pushed
the
mike/05-fix-empty-arrays
branch
from
November 3, 2026 03:53
b2d1778 to
5ec8232
Compare
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.
What
createalways sorted its input keys, andsort_advancedcannot be compiled for an emptyarray ("Could not determine loop bound at compile-time"), so neither array could be created
without initial entries; an initially empty
MutSparseArrayis a natural use. Only insertthe sentinels when there are no input keys.
Testing
New
test_sparse_lookup_emptyandtest_create_empty(which also covers size 1, where 0 ismaximum). An emptycreatefails to compile onmaster.nargo test(Noir 1.0.0): 26/26passed.