BUG: Lucene.Net.Util.Fst.FSTEnum<T>: Fixed call to FST<T>.ReadNextArcLabel() so it doesn't happen unless arc.IsLast is false. However, the call is done outside of Debug.Assert so it still runs when the asserts are stripped out by the compiler.
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/08c81c8e Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/08c81c8e Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/08c81c8e Branch: refs/heads/master Commit: 08c81c8ef7adcfcf32cfbafbf8689319301f858f Parents: aa0a3f3 Author: Shad Storhaug <[email protected]> Authored: Sun May 14 04:07:54 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Tue May 16 19:17:12 2017 +0700 ---------------------------------------------------------------------- src/Lucene.Net/Util/Fst/FSTEnum.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/08c81c8e/src/Lucene.Net/Util/Fst/FSTEnum.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net/Util/Fst/FSTEnum.cs b/src/Lucene.Net/Util/Fst/FSTEnum.cs index 331cbf1..8298fdf 100644 --- a/src/Lucene.Net/Util/Fst/FSTEnum.cs +++ b/src/Lucene.Net/Util/Fst/FSTEnum.cs @@ -422,8 +422,11 @@ namespace Lucene.Net.Util.Fst arc.ArcIdx = (low > high ? high : low) - 1; //System.out.println(" hasFloor arcIdx=" + (arc.arcIdx+1)); m_fst.ReadNextRealArc(arc, @in); - int label = m_fst.ReadNextArcLabel(arc, @in); - Debug.Assert(arc.IsLast || label > targetLabel); + + // LUCNENET specific: We don't want the ReadNextArcLabel call to be + // excluded when Debug.Assert is stripped out by the compiler. + bool check = arc.IsLast || m_fst.ReadNextArcLabel(arc, @in) > targetLabel; + Debug.Assert(check); Debug.Assert(arc.Label < targetLabel, "arc.label=" + arc.Label + " vs targetLabel=" + targetLabel); PushLast(); return;
