From 483f3b94ee75af19739e3a0119d127ee4aa602c2 Mon Sep 17 00:00:00 2001
From: Niko Stotz <niko@nikostotz.de>
Date: Tue, 19 Nov 2024 13:06:07 +0100
Subject: [PATCH] make sure mpsutil.compare.AssertNodeEquals validates even
 without ignored properties or references

---
 .../languageModels/typesystem.mps             | 107 ++++++++++++------
 .../com/mbeddr/mpsutil/compare/ts@tests.mps   |  49 ++++++++
 2 files changed, 120 insertions(+), 36 deletions(-)

diff --git a/code/languages/com.mbeddr.mpsutil/languages/com.mbeddr.mpsutil.compare/languageModels/typesystem.mps b/code/languages/com.mbeddr.mpsutil/languages/com.mbeddr.mpsutil.compare/languageModels/typesystem.mps
index b14253671fb..3948d0096d1 100644
--- a/code/languages/com.mbeddr.mpsutil/languages/com.mbeddr.mpsutil.compare/languageModels/typesystem.mps
+++ b/code/languages/com.mbeddr.mpsutil/languages/com.mbeddr.mpsutil.compare/languageModels/typesystem.mps
@@ -21,6 +21,10 @@
       </concept>
       <concept id="1070534370425" name="jetbrains.mps.baseLanguage.structure.IntegerType" flags="in" index="10Oyi0" />
       <concept id="1068580123157" name="jetbrains.mps.baseLanguage.structure.Statement" flags="nn" index="3clFbH" />
+      <concept id="1068580123159" name="jetbrains.mps.baseLanguage.structure.IfStatement" flags="nn" index="3clFbJ">
+        <child id="1068580123160" name="condition" index="3clFbw" />
+        <child id="1068580123161" name="ifTrue" index="3clFbx" />
+      </concept>
       <concept id="1068580123136" name="jetbrains.mps.baseLanguage.structure.StatementList" flags="sn" stub="5293379017992965193" index="3clFbS">
         <child id="1068581517665" name="statement" index="3cqZAp" />
       </concept>
@@ -66,6 +70,7 @@
     </language>
     <language id="7866978e-a0f0-4cc7-81bc-4d213d9375e1" name="jetbrains.mps.lang.smodel">
       <concept id="1145383075378" name="jetbrains.mps.lang.smodel.structure.SNodeListType" flags="in" index="2I9FWS" />
+      <concept id="1172008320231" name="jetbrains.mps.lang.smodel.structure.Node_IsNotNullOperation" flags="nn" index="3x8VRR" />
       <concept id="1180636770613" name="jetbrains.mps.lang.smodel.structure.SNodeCreator" flags="nn" index="3zrR0B">
         <child id="1180636770616" name="createdType" index="3zrR0E" />
       </concept>
@@ -90,56 +95,86 @@
   <node concept="1YbPZF" id="2lpUxXMeGs2">
     <property role="TrG5h" value="typeof_AssertNodeEquals" />
     <node concept="3clFbS" id="2lpUxXMeGs3" role="18ibNy">
-      <node concept="1Z5TYs" id="2lpUxXMeKAX" role="3cqZAp">
-        <node concept="mw_s8" id="2lpUxXMeKEF" role="1ZfhKB">
-          <node concept="2c44tf" id="2lpUxXMeKEB" role="mwGJk">
-            <node concept="_YKpA" id="780iRhMrGX3" role="2c44tc">
-              <node concept="3uibUv" id="780iRhMrGX4" role="_ZDj9">
-                <ref role="3uigEE" to="mqum:DYlgnBstFb" resolve="IgnoredProperty" />
+      <node concept="3clFbJ" id="5ktnDmVWtku" role="3cqZAp">
+        <node concept="3clFbS" id="5ktnDmVWtkw" role="3clFbx">
+          <node concept="1Z5TYs" id="2lpUxXMeKAX" role="3cqZAp">
+            <node concept="mw_s8" id="2lpUxXMeKEF" role="1ZfhKB">
+              <node concept="2c44tf" id="2lpUxXMeKEB" role="mwGJk">
+                <node concept="_YKpA" id="780iRhMrGX3" role="2c44tc">
+                  <node concept="3uibUv" id="780iRhMrGX4" role="_ZDj9">
+                    <ref role="3uigEE" to="mqum:DYlgnBstFb" resolve="IgnoredProperty" />
+                  </node>
+                </node>
               </node>
             </node>
-          </node>
-        </node>
-        <node concept="mw_s8" id="2lpUxXMeKB0" role="1ZfhK$">
-          <node concept="1Z2H0r" id="2lpUxXMeGsZ" role="mwGJk">
-            <node concept="2OqwBi" id="2lpUxXMeGCG" role="1Z2MuG">
-              <node concept="1YBJjd" id="2lpUxXMeGto" role="2Oq$k0">
-                <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
-              </node>
-              <node concept="3TrEf2" id="2lpUxXMeK8J" role="2OqNvi">
-                <ref role="3Tt5mk" to="8do3:2lpUxXMduaL" resolve="ignoredProperties" />
+            <node concept="mw_s8" id="2lpUxXMeKB0" role="1ZfhK$">
+              <node concept="1Z2H0r" id="2lpUxXMeGsZ" role="mwGJk">
+                <node concept="2OqwBi" id="2lpUxXMeGCG" role="1Z2MuG">
+                  <node concept="1YBJjd" id="2lpUxXMeGto" role="2Oq$k0">
+                    <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+                  </node>
+                  <node concept="3TrEf2" id="2lpUxXMeK8J" role="2OqNvi">
+                    <ref role="3Tt5mk" to="8do3:2lpUxXMduaL" resolve="ignoredProperties" />
+                  </node>
+                </node>
               </node>
             </node>
+            <node concept="1YBJjd" id="77BxNvs6uQY" role="1ZmcU8">
+              <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+            </node>
           </node>
         </node>
-        <node concept="1YBJjd" id="77BxNvs6uQY" role="1ZmcU8">
-          <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
-        </node>
-      </node>
-      <node concept="1Z5TYs" id="3qPjHtYqU7C" role="3cqZAp">
-        <node concept="mw_s8" id="3qPjHtYqU7D" role="1ZfhKB">
-          <node concept="2c44tf" id="3qPjHtYqU7E" role="mwGJk">
-            <node concept="_YKpA" id="3qPjHtYqU7F" role="2c44tc">
-              <node concept="3uibUv" id="3qPjHtYqUrU" role="_ZDj9">
-                <ref role="3uigEE" to="mqum:2mzdNw3ouFX" resolve="IgnoredReference" />
-              </node>
+        <node concept="2OqwBi" id="5ktnDmVWub_" role="3clFbw">
+          <node concept="2OqwBi" id="5ktnDmVWt$D" role="2Oq$k0">
+            <node concept="1YBJjd" id="5ktnDmVWtkD" role="2Oq$k0">
+              <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+            </node>
+            <node concept="3TrEf2" id="5ktnDmVWtZD" role="2OqNvi">
+              <ref role="3Tt5mk" to="8do3:2lpUxXMduaL" resolve="ignoredProperties" />
             </node>
           </node>
+          <node concept="3x8VRR" id="5ktnDmVWupE" role="2OqNvi" />
         </node>
-        <node concept="mw_s8" id="3qPjHtYqU7H" role="1ZfhK$">
-          <node concept="1Z2H0r" id="3qPjHtYqU7I" role="mwGJk">
-            <node concept="2OqwBi" id="3qPjHtYqU7J" role="1Z2MuG">
-              <node concept="1YBJjd" id="3qPjHtYqU7K" role="2Oq$k0">
-                <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+      </node>
+      <node concept="3clFbJ" id="5ktnDmVWuwJ" role="3cqZAp">
+        <node concept="3clFbS" id="5ktnDmVWuwL" role="3clFbx">
+          <node concept="1Z5TYs" id="3qPjHtYqU7C" role="3cqZAp">
+            <node concept="mw_s8" id="3qPjHtYqU7D" role="1ZfhKB">
+              <node concept="2c44tf" id="3qPjHtYqU7E" role="mwGJk">
+                <node concept="_YKpA" id="3qPjHtYqU7F" role="2c44tc">
+                  <node concept="3uibUv" id="3qPjHtYqUrU" role="_ZDj9">
+                    <ref role="3uigEE" to="mqum:2mzdNw3ouFX" resolve="IgnoredReference" />
+                  </node>
+                </node>
               </node>
-              <node concept="3TrEf2" id="3qPjHtYqUDR" role="2OqNvi">
-                <ref role="3Tt5mk" to="8do3:3qPjHtYqU7z" resolve="ignoredReferences" />
+            </node>
+            <node concept="mw_s8" id="3qPjHtYqU7H" role="1ZfhK$">
+              <node concept="1Z2H0r" id="3qPjHtYqU7I" role="mwGJk">
+                <node concept="2OqwBi" id="3qPjHtYqU7J" role="1Z2MuG">
+                  <node concept="1YBJjd" id="3qPjHtYqU7K" role="2Oq$k0">
+                    <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+                  </node>
+                  <node concept="3TrEf2" id="3qPjHtYqUDR" role="2OqNvi">
+                    <ref role="3Tt5mk" to="8do3:3qPjHtYqU7z" resolve="ignoredReferences" />
+                  </node>
+                </node>
               </node>
             </node>
+            <node concept="1YBJjd" id="77BxNvs6uR1" role="1ZmcU8">
+              <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+            </node>
           </node>
         </node>
-        <node concept="1YBJjd" id="77BxNvs6uR1" role="1ZmcU8">
-          <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+        <node concept="2OqwBi" id="5ktnDmVWv2J" role="3clFbw">
+          <node concept="2OqwBi" id="5ktnDmVWux8" role="2Oq$k0">
+            <node concept="1YBJjd" id="5ktnDmVWuwU" role="2Oq$k0">
+              <ref role="1YBMHb" node="2lpUxXMeGs5" resolve="assertNodeEquals" />
+            </node>
+            <node concept="3TrEf2" id="5ktnDmVWv0l" role="2OqNvi">
+              <ref role="3Tt5mk" to="8do3:3qPjHtYqU7z" resolve="ignoredReferences" />
+            </node>
+          </node>
+          <node concept="3x8VRR" id="5ktnDmVWv89" role="2OqNvi" />
         </node>
       </node>
       <node concept="1ZobV4" id="2lpUxXMeYl$" role="3cqZAp">
diff --git a/code/languages/com.mbeddr.mpsutil/tests/test.com.mbeddr.mpsutil.compare/models/test/com/mbeddr/mpsutil/compare/ts@tests.mps b/code/languages/com.mbeddr.mpsutil/tests/test.com.mbeddr.mpsutil.compare/models/test/com/mbeddr/mpsutil/compare/ts@tests.mps
index fc3fc0bfafa..61db108eb05 100644
--- a/code/languages/com.mbeddr.mpsutil/tests/test.com.mbeddr.mpsutil.compare/models/test/com/mbeddr/mpsutil/compare/ts@tests.mps
+++ b/code/languages/com.mbeddr.mpsutil/tests/test.com.mbeddr.mpsutil.compare/models/test/com/mbeddr/mpsutil/compare/ts@tests.mps
@@ -14,6 +14,12 @@
   </imports>
   <registry>
     <language id="8585453e-6bfb-4d80-98de-b16074f1d86c" name="jetbrains.mps.lang.test">
+      <concept id="1215603922101" name="jetbrains.mps.lang.test.structure.NodeOperationsContainer" flags="ng" index="7CXmI">
+        <child id="1215604436604" name="nodeOperations" index="7EUXB" />
+      </concept>
+      <concept id="1215607067978" name="jetbrains.mps.lang.test.structure.CheckNodeForErrorMessagesOperation" flags="ng" index="7OXhh">
+        <property id="3743352646565420194" name="includeSelf" index="GvXf4" />
+      </concept>
       <concept id="5097124989038916362" name="jetbrains.mps.lang.test.structure.TestInfo" flags="ng" index="2XOHcx">
         <property id="5097124989038916363" name="projectPath" index="2XOHcw" />
       </concept>
@@ -54,6 +60,7 @@
         <reference id="1144433194310" name="classConcept" index="1Pybhc" />
       </concept>
       <concept id="1070534370425" name="jetbrains.mps.baseLanguage.structure.IntegerType" flags="in" index="10Oyi0" />
+      <concept id="1068390468198" name="jetbrains.mps.baseLanguage.structure.ClassConcept" flags="ig" index="312cEu" />
       <concept id="1068431474542" name="jetbrains.mps.baseLanguage.structure.VariableDeclaration" flags="ng" index="33uBYm">
         <child id="1068431790190" name="initializer" index="33vP2m" />
       </concept>
@@ -95,6 +102,9 @@
         <reference id="1068499141037" name="baseMethodDeclaration" index="37wK5l" />
         <child id="1068499141038" name="actualArgument" index="37wK5m" />
       </concept>
+      <concept id="1107461130800" name="jetbrains.mps.baseLanguage.structure.Classifier" flags="ng" index="3pOWGL">
+        <child id="5375687026011219971" name="member" index="jymVt" unordered="true" />
+      </concept>
       <concept id="1107535904670" name="jetbrains.mps.baseLanguage.structure.ClassifierType" flags="in" index="3uibUv">
         <reference id="1107535924139" name="classifier" index="3uigEE" />
       </concept>
@@ -142,6 +152,7 @@
     </language>
     <language id="f47b95d4-5e73-4c04-9204-18076950153b" name="com.mbeddr.mpsutil.compare">
       <concept id="1831260205537497726" name="com.mbeddr.mpsutil.compare.structure.AreEqualExpression" flags="ng" index="13dIca" />
+      <concept id="756135271275943220" name="com.mbeddr.mpsutil.compare.structure.AssertNodeEquals" flags="ng" index="3GXo0L" />
     </language>
     <language id="f61473f9-130f-42f6-b98d-6c438812c2f6" name="jetbrains.mps.baseLanguage.unitTest">
       <concept id="8427750732757990717" name="jetbrains.mps.baseLanguage.unitTest.structure.BinaryAssert" flags="nn" index="3tpDYu">
@@ -823,5 +834,43 @@
       </node>
     </node>
   </node>
+  <node concept="1lH9Xt" id="5ktnDmVWo_W">
+    <property role="3DII0k" value="2hh8MJdVwqX/command" />
+    <property role="TrG5h" value="AssertNodeEquals" />
+    <node concept="1qefOq" id="5ktnDmVWo_X" role="1SKRRt">
+      <node concept="312cEu" id="5ktnDmVWo_Z" role="1qenE9">
+        <property role="TrG5h" value="MyClass" />
+        <node concept="2YIFZL" id="5ktnDmVWoBq" role="jymVt">
+          <property role="TrG5h" value="x" />
+          <node concept="3clFbS" id="5ktnDmVWoBt" role="3clF47">
+            <node concept="3GXo0L" id="5ktnDmVWoDX" role="3cqZAp">
+              <node concept="37vLTw" id="5ktnDmVWoEz" role="3tpDZB">
+                <ref role="3cqZAo" node="5ktnDmVWoCI" resolve="a" />
+              </node>
+              <node concept="37vLTw" id="5ktnDmVWoFo" role="3tpDZA">
+                <ref role="3cqZAo" node="5ktnDmVWoD1" resolve="b" />
+              </node>
+              <node concept="7CXmI" id="5ktnDmVWoFP" role="lGtFl">
+                <node concept="7OXhh" id="5ktnDmVWoGf" role="7EUXB">
+                  <property role="GvXf4" value="true" />
+                </node>
+              </node>
+            </node>
+          </node>
+          <node concept="3Tm1VV" id="5ktnDmVWoAz" role="1B3o_S" />
+          <node concept="3cqZAl" id="5ktnDmVWoBg" role="3clF45" />
+          <node concept="37vLTG" id="5ktnDmVWoCI" role="3clF46">
+            <property role="TrG5h" value="a" />
+            <node concept="3Tqbb2" id="5ktnDmVWoCH" role="1tU5fm" />
+          </node>
+          <node concept="37vLTG" id="5ktnDmVWoD1" role="3clF46">
+            <property role="TrG5h" value="b" />
+            <node concept="3Tqbb2" id="5ktnDmVWoDu" role="1tU5fm" />
+          </node>
+        </node>
+        <node concept="3Tm1VV" id="5ktnDmVWoA0" role="1B3o_S" />
+      </node>
+    </node>
+  </node>
 </model>