From 4c19c5dfae01638ae66fc2c1561762d94fb36a1a Mon Sep 17 00:00:00 2001 From: cooldome Date: Wed, 4 Nov 2020 18:52:53 +0000 Subject: [PATCH] fix static[Slice[T]] as argument issue (#15842) --- compiler/sigmatch.nim | 2 +- tests/types/tisopr.nim | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 2cf2846c09..d5039fcada 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1079,7 +1079,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, return typeRel(c, f, lastSon(aOrig), flags) if a.kind == tyGenericInst and - skipTypes(f, {tyVar, tyLent, tySink}).kind notin { + skipTypes(f, {tyStatic, tyVar, tyLent, tySink}).kind notin { tyGenericBody, tyGenericInvocation, tyGenericInst, tyGenericParam} + tyTypeClasses: return typeRel(c, f, lastSon(a), flags) diff --git a/tests/types/tisopr.nim b/tests/types/tisopr.nim index 1bbd0da94e..533cf05beb 100644 --- a/tests/types/tisopr.nim +++ b/tests/types/tisopr.nim @@ -109,3 +109,15 @@ block: doAssert Foo2[int,float|int] is Foo doAssert Foo2[int,float|int] isnot Bar doAssert int is (int|float) + + +block: + # Slice[T] as static type issue + type + MyEnum = enum + x1, x2, x3, x4, x5, x6 + + proc enumGen[T: enum](s: static[Slice[T]]) = + doAssert($s.a & " " & $s.b == "x1 x3") + + enumGen(x1..x3)