From f55f3d6ffd9df948f9c66b3a4ef4b9c95d843832 Mon Sep 17 00:00:00 2001 From: Bung Date: Wed, 9 Aug 2023 23:17:08 +0800 Subject: [PATCH] Fix #5780 (#22428) * fix #5780 (cherry picked from commit 46e94c83d451895ead4f51686f614d8c9b1e384c) --- compiler/sigmatch.nim | 2 +- tests/statictypes/t5780.nim | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 tests/statictypes/t5780.nim diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 8f5a59b7cd..558f4d6e8e 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1171,7 +1171,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, of tyArray: var fRange = f[0] var aRange = a[0] - if fRange.kind == tyGenericParam: + if fRange.kind in {tyGenericParam, tyAnything}: var prev = PType(idTableGet(c.bindings, fRange)) if prev == nil: put(c, fRange, a[0]) diff --git a/tests/statictypes/t5780.nim b/tests/statictypes/t5780.nim new file mode 100644 index 0000000000..85548aaadd --- /dev/null +++ b/tests/statictypes/t5780.nim @@ -0,0 +1,3 @@ +type StringArray[N:int] = array[N, string] +let a = ["one", "two"] +doAssert a is StringArray