You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two LogicValue's which are equal according to == may have different hash codes.
This creates unintended behavior when LogicValue's are used in data structures which leverage hash codes, such as a Map.
Based on preliminary testing, my very rough guess is that LogicValue flavors which are based on the underlying _LogicValueEnum type have different hash codes than LogicValue flavors which are based on the int and BigInt types.
To Reproduce
I made a test which can be pasted into test/logic_value_test.dart
Try uncommenting the tests that fail to reproduce.
Equality of value as judged by == implies equality of hash code.
Actual behavior
Equality of value as judged by == does not imply equality of hash code.
Additional: Dart SDK info
Dart SDK version: 2.18.4 (stable) (Unknown timestamp) on "linux_x64"
Additional: pubspec.yaml
name: rohddescription: The Rapid Open Hardware Development (ROHD) framework, a framework for describing and verifying hardwareversion: 0.4.0homepage: https://github.com/intel/rohdrepository: https://github.com/intel/rohdissue_tracker: https://github.com/intel/rohd/issuesdocumentation: https://intel.github.io/rohd/rohd/rohd-library.htmlenvironment:
sdk: '>=2.18.0 <3.0.0'dependencies:
collection: ^1.15.0logging: ^1.0.1meta: ^1.3.0test: ^1.17.3dev_dependencies:
benchmark_harness: ^2.2.0
Additional: Context
I reproduced this bug in the most up-to-date version of the ROHD repo, on branch main, where the working directory is completely clean of local changes except for the aforementioned logic_value_test.dart file. That is where the pubspec.yaml comes from.
The text was updated successfully, but these errors were encountered:
Describe the bug
Two LogicValue's which are equal according to
==
may have different hash codes.This creates unintended behavior when LogicValue's are used in data structures which leverage hash codes, such as a
Map
.Based on preliminary testing, my very rough guess is that LogicValue flavors which are based on the underlying
_LogicValueEnum
type have different hash codes than LogicValue flavors which are based on theint
andBigInt
types.To Reproduce
I made a test which can be pasted into
test/logic_value_test.dart
Try uncommenting the tests that fail to reproduce.
Expected behavior
Equality of value as judged by
==
implies equality of hash code.Actual behavior
Equality of value as judged by
==
does not imply equality of hash code.Additional: Dart SDK info
Dart SDK version: 2.18.4 (stable) (Unknown timestamp) on "linux_x64"
Additional: pubspec.yaml
Additional: Context
I reproduced this bug in the most up-to-date version of the ROHD repo, on branch main, where the working directory is completely clean of local changes except for the aforementioned
logic_value_test.dart
file. That is where thepubspec.yaml
comes from.The text was updated successfully, but these errors were encountered: