From d8860f7a0443269cff36043e3059af55912b01c8 Mon Sep 17 00:00:00 2001 From: tinysec Date: Wed, 8 Jul 2026 13:24:46 +0800 Subject: [PATCH] fix: DisassemblyTextLine/LinearDisassemblyLine Equals(object) cast Copy-paste defect from InstructionTextToken: both Equals(object?) overloads cast the other operand with `rawOther as InstructionTextToken`, which is always null for these types, so equality always returned false (and passing an InstructionTextToken recursed into its Equals(object)). Each must cast to its own type and delegate to the typed Equals. The typed Equals(T?) and the == / != operators were already correct. Mirrors Python's DisassemblyTextLine.__eq__ (function.py:3801) which compares the rendered line fields. --- Struct/BNDisassemblyTextLine.cs | 2 +- Struct/BNLinearDisassemblyLine.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Struct/BNDisassemblyTextLine.cs b/Struct/BNDisassemblyTextLine.cs index dbaab92..3dcf6c6 100644 --- a/Struct/BNDisassemblyTextLine.cs +++ b/Struct/BNDisassemblyTextLine.cs @@ -130,7 +130,7 @@ public override string ToString() public override bool Equals(object? rawOther) { - InstructionTextToken? other = rawOther as InstructionTextToken; + DisassemblyTextLine? other = rawOther as DisassemblyTextLine; if (other is null) { diff --git a/Struct/BNLinearDisassemblyLine.cs b/Struct/BNLinearDisassemblyLine.cs index dac2448..7cf9a51 100644 --- a/Struct/BNLinearDisassemblyLine.cs +++ b/Struct/BNLinearDisassemblyLine.cs @@ -88,7 +88,7 @@ public override string ToString() public override bool Equals(object? rawOther) { - InstructionTextToken? other = rawOther as InstructionTextToken; + LinearDisassemblyLine? other = rawOther as LinearDisassemblyLine; if (other is null) {