From 840abbf55d25c5a9f68a938c3ae60bbb30277f20 Mon Sep 17 00:00:00 2001 From: Pavel Tomin <_xyz_@mail.ru> Date: Fri, 5 Jan 2024 13:33:18 +0500 Subject: [PATCH] Create Unifier test: Unify(double, TypeReference(struct (0 double))) => TypeReference(struct (0 double)) ``` Expected: "STR" But was: "(union (real64 u1) (STR u0))" ``` --- src/UnitTests/Decompiler/Typing/UnifierTests.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/UnitTests/Decompiler/Typing/UnifierTests.cs b/src/UnitTests/Decompiler/Typing/UnifierTests.cs index 7c4907a9f9..47a107c98f 100644 --- a/src/UnitTests/Decompiler/Typing/UnifierTests.cs +++ b/src/UnitTests/Decompiler/Typing/UnifierTests.cs @@ -531,6 +531,17 @@ public void UnifyTypeReferences() Assert.AreEqual("CHAR", un.Unify(t1, t2).ToString()); } + [Test] + public void UnifyDoubleWithFieldAt0OffsetOfTypeReferenceToStruct() + { + var t1 = new TypeReference("STR", new StructureType + { + Fields = { { 0, PrimitiveType.Real64 } } + }); + var t2 = PrimitiveType.Real64; + Assert.AreEqual("STR", un.Unify(t1, t2).ToString()); + } + [Test] public void Unify_AreUnknownCompatible() {