Skip to content

Commit

Permalink
fix(positioned_note): use correct hashCode values
Browse files Browse the repository at this point in the history
Closes #106
  • Loading branch information
albertms10 committed May 27, 2023
1 parent 50535fa commit 5fbc43f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/note/positioned_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ final class PositionedNote
other is PositionedNote && note == other.note && octave == other.octave;

@override
int get hashCode => Object.hash(super.hashCode, octave);
int get hashCode => Object.hash(note, octave);

@override
int compareTo(PositionedNote other) => compareMultiple([
Expand Down
2 changes: 2 additions & 0 deletions test/src/note/positioned_note_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -694,12 +694,14 @@ void main() {
final collection = {
Note.c.inOctave(4),
Note.a.flat.inOctave(2),
Note.d.inOctave(4),
Note.g.sharp.inOctave(5),
};
collection.addAll(collection);
expect(collection.toList(), [
Note.c.inOctave(4),
Note.a.flat.inOctave(2),
Note.d.inOctave(4),
Note.g.sharp.inOctave(5),
]);
});
Expand Down

0 comments on commit 5fbc43f

Please sign in to comment.