BUG: Lucene.Net.Util.Fst.FST: SetAssertingRootArcs() must always be called, 
even when Debug.Assert is compiled out


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5507808d
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5507808d
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5507808d

Branch: refs/heads/api-work
Commit: 5507808d4dc0aefb77c87d95196384f50a2adb27
Parents: f87d8ad
Author: Shad Storhaug <[email protected]>
Authored: Sun Apr 9 18:32:46 2017 +0700
Committer: Shad Storhaug <[email protected]>
Committed: Sun Apr 9 18:32:46 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net/Util/Fst/FST.cs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5507808d/src/Lucene.Net/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Util/Fst/FST.cs b/src/Lucene.Net/Util/Fst/FST.cs
index 46a4966..dfefd63 100644
--- a/src/Lucene.Net/Util/Fst/FST.cs
+++ b/src/Lucene.Net/Util/Fst/FST.cs
@@ -392,7 +392,8 @@ namespace Lucene.Net.Util.Fst
             cachedRootArcs = (FST.Arc<T>[])new FST.Arc<T>[0x80];
             ReadRootArcs(cachedRootArcs);
 
-            Debug.Assert(SetAssertingRootArcs(cachedRootArcs));
+            bool set = SetAssertingRootArcs(cachedRootArcs);
+            Debug.Assert(set);
             Debug.Assert(AssertRootArcs());
         }
 
@@ -455,7 +456,9 @@ namespace Lucene.Net.Util.Fst
                         : Collections.Equals(root.NextFinalOutput, 
asserting.NextFinalOutput));
                     Debug.Assert(root.Node == asserting.Node);
                     Debug.Assert(root.NumArcs == asserting.NumArcs);
-                    Debug.Assert(root.Output.Equals(asserting.Output));
+                    Debug.Assert(typeof(T).GetTypeInfo().IsValueType
+                        ? root.Output.Equals(asserting.Output)
+                        : Collections.Equals(root.Output, asserting.Output));
                     Debug.Assert(root.PosArcsStart == asserting.PosArcsStart);
                     Debug.Assert(root.Target == asserting.Target);
                 }

Reply via email to