From 5c86c1eda9cd75e0fa85b132ca4c8306e9fc81d5 Mon Sep 17 00:00:00 2001 From: cui Date: Fri, 27 Mar 2026 17:20:10 +0800 Subject: [PATCH] fixes #25670; docgen: cmpDecimalsIgnoreCase max() used wrong index for b (#25669) Fixes bug #25670. The second argument to `max` in `cmpDecimalsIgnoreCase` used `limitB - iA` instead of `limitB - iB`, which could mis-order numeric segments when sorting doc index entries. --- compiler/docgen.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index 307761409c..71af95a5f2 100644 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -148,7 +148,7 @@ proc cmpDecimalsIgnoreCase(a, b: string): int = limitB = iB while limitA < aLen and isDigit(a[limitA]): inc limitA while limitB < bLen and isDigit(b[limitB]): inc limitB - var pos = max(limitA-iA, limitB-iA) + var pos = max(limitA-iA, limitB-iB) while pos > 0: if limitA-pos < iA: # digit in `a` is 0 effectively result = ord('0') - ord(b[limitB-pos])