From 5fbc43fa5764f49b3ec33e7b3227b3d032045f1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Ma=C3=B1osa?= Date: Sun, 28 May 2023 01:09:34 +0200 Subject: [PATCH] fix(positioned_note): use correct `hashCode` values Closes #106 --- lib/src/note/positioned_note.dart | 2 +- test/src/note/positioned_note_test.dart | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/src/note/positioned_note.dart b/lib/src/note/positioned_note.dart index 69383d80..a330bae9 100644 --- a/lib/src/note/positioned_note.dart +++ b/lib/src/note/positioned_note.dart @@ -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([ diff --git a/test/src/note/positioned_note_test.dart b/test/src/note/positioned_note_test.dart index d5a4eaa8..f7545453 100644 --- a/test/src/note/positioned_note_test.dart +++ b/test/src/note/positioned_note_test.dart @@ -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), ]); });