Skip to content

[Fix] StackItem.GetHashCode for CompoundType#3549

Merged
shargon merged 19 commits intoneo-project:masterfrom
cschuchardt88:fix/compoundtype-hashcode
Nov 6, 2024
Merged

[Fix] StackItem.GetHashCode for CompoundType#3549
shargon merged 19 commits intoneo-project:masterfrom
cschuchardt88:fix/compoundtype-hashcode

Conversation

@cschuchardt88
Copy link
Member

@cschuchardt88 cschuchardt88 commented Oct 23, 2024

Description

Close #3544

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@shargon shargon mentioned this pull request Nov 4, 2024
15 tasks
@shargon shargon added the Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. label Nov 4, 2024
@shargon shargon merged commit 42f0efd into neo-project:master Nov 6, 2024
@shargon shargon deleted the fix/compoundtype-hashcode branch November 6, 2024 07:35
foreach (var item in SubItems)
{
// This isn't prefect and leaves somethings unsolved.
if (item is CompoundType cItem)
Copy link
Contributor

@nan01ab nan01ab Nov 14, 2024

Choose a reason for hiding this comment

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

There is such a cause here:

            var map1 = new Map();
            map1[1] = 2;
            map1[3] = 4;

            var map2 = new Map();
            map2[3] = 4;
            map2[1] = 2;
        
            Assert.AreEqual(map1.GetHashCode(), map2.GetHashCode());

Assert.AreEqual failed.
Because VM.Map uses OrderedDictionary internally, but OrderedDictionary is not ordered.

it should be fixed or not ?

Copy link
Member

Choose a reason for hiding this comment

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

It could be fixed in a new PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. Ready to Merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StackItem.GetHashCode probably shouldn't throw any Exception.

5 participants