Skip to content
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

close #15767 #16959

Merged
merged 3 commits into from Feb 8, 2021
Merged

close #15767 #16959

merged 3 commits into from Feb 8, 2021

Conversation

ringabout
Copy link
Member

@ringabout ringabout commented Feb 7, 2021

After this PR
sets.nim(910, 11) len(s) == length the length of the OrderedSet changed while iterating over it [AssertionDefect]

I keep the same behaviour as when iterating over tables/etc(I can fix other similar stuffs in the future's PRs if performance lossy is worthy).

if isFilled(s.data[h].hcode): yield s.data[h].key
if isFilled(s.data[h].hcode):
yield s.data[h].key
assert(len(s) == length, "the length of the HashSet changed while iterating over it")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY: how about use an auxiliary template:

template checkLen(a, b) =
  const s = "the length of " & $type(a) & " changed while iterating over it"
  assert len(a) == length, s

makes it easy to change in 1 place (eg if we want to add runtime info $(len(a), length) for extended debugging)

@Araq Araq merged commit 0cf3ba1 into nim-lang:devel Feb 8, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
* fix some warnings

* close nim-lang#15767

* Revert "fix some warnings"

This reverts commit 39f2f23.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants