From cc887c23f4a0da4a2e486b37f44707e51d9b1506 Mon Sep 17 00:00:00 2001 From: Ryan McConnell Date: Thu, 11 Jul 2024 16:57:17 -0400 Subject: [PATCH] fixes 23823; array static overload - again (#23824) #23823 (cherry picked from commit 22ba5abd635a1b50c76acb0b80097a663cdf97c9) --- compiler/sigmatch.nim | 2 ++ tests/overload/t23755.nim | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index fbeddcaf1c..e703a23cd5 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1313,6 +1313,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, return isNone if fRange.rangeHasUnresolvedStatic: + if aRange.kind in {tyGenericParam} and aRange.reduceToBase() == aRange: + return return inferStaticsInRange(c, fRange, a) elif c.c.matchedConcept != nil and aRange.rangeHasUnresolvedStatic: return inferStaticsInRange(c, aRange, f) diff --git a/tests/overload/t23755.nim b/tests/overload/t23755.nim index 3d06cee658..de338a2ce9 100644 --- a/tests/overload/t23755.nim +++ b/tests/overload/t23755.nim @@ -50,3 +50,13 @@ block: var g: array[32, char] doAssert p(g) + +block: # issue #23823 + func p[N,T](a, b: array[N,T]) = + discard + + func p[N: static int; T](x, y: array[N, T]) = + discard + + var a: array[5, int] + p(a,a)