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

[Regression] JS: HashSet hash at compile time and run time not equal #15624

Closed
nitely opened this issue Oct 18, 2020 · 2 comments
Closed

[Regression] JS: HashSet hash at compile time and run time not equal #15624

nitely opened this issue Oct 18, 2020 · 2 comments

Comments

@nitely
Copy link
Contributor

nitely commented Oct 18, 2020

This works in C and C++ backends, but fails in JS.

Example

import sets
const foo = ['a'].toHashSet
echo 'a' in foo

Current Output

false

Expected Output

true

Additional Information

  • const a = hash('a'); echo a outputs 0, it's probably related, or maybe another bug
  • This used to work in v1.0.x and v1.2.x
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2020-10-18
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: b16b2eb06fa09b22ab50b3bd2703fe79c0ca4fc6
active boot switches: -d:release
@ringabout
Copy link
Member

@nitely
This is caused by new hash algorithm:

Workaround:

-d:nimIntHash1

@ringabout
Copy link
Member

Related:
#13823

c-blake added a commit to c-blake/Nim that referenced this issue Nov 12, 2020
resolve the problem mentioned there (`hash() == 0`) as well as
to close nim-lang#15624
@Araq Araq closed this as completed in a9bd4c4 Nov 13, 2020
ringabout added a commit that referenced this issue Dec 13, 2020
* test for issue #15624 and PR #15915 for patch #13823

* Update thashes.nim

no need mention PR #15915, fixed in #15937

* rebase to devel(issue maybe fixed), ignore ouputs

* Apply suggestions from code review

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
PMunch pushed a commit to PMunch/Nim that referenced this issue Jan 6, 2021
* Alternate PR to nim-lang#15915 to
resolve the problem mentioned there (`hash() == 0`) as well as
to close nim-lang#15624

* Address nim-lang#15937 (comment)
{ though this was only a move from 2 copies to 3 copies. ;-) }
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
* Alternate PR to nim-lang#15915 to
resolve the problem mentioned there (`hash() == 0`) as well as
to close nim-lang#15624

* Address nim-lang#15937 (comment)
{ though this was only a move from 2 copies to 3 copies. ;-) }
mildred pushed a commit to mildred/Nim that referenced this issue Jan 11, 2021
* test for issue nim-lang#15624 and PR nim-lang#15915 for patch nim-lang#13823

* Update thashes.nim

no need mention PR nim-lang#15915, fixed in nim-lang#15937

* rebase to devel(issue maybe fixed), ignore ouputs

* Apply suggestions from code review

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
irdassis pushed a commit to irdassis/Nim that referenced this issue Mar 16, 2021
* Alternate PR to nim-lang#15915 to
resolve the problem mentioned there (`hash() == 0`) as well as
to close nim-lang#15624

* Address nim-lang#15937 (comment)
{ though this was only a move from 2 copies to 3 copies. ;-) }
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
* Alternate PR to nim-lang#15915 to
resolve the problem mentioned there (`hash() == 0`) as well as
to close nim-lang#15624

* Address nim-lang#15937 (comment)
{ though this was only a move from 2 copies to 3 copies. ;-) }
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
* test for issue nim-lang#15624 and PR nim-lang#15915 for patch nim-lang#13823

* Update thashes.nim

no need mention PR nim-lang#15915, fixed in nim-lang#15937

* rebase to devel(issue maybe fixed), ignore ouputs

* Apply suggestions from code review

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants