summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorcooldome <ariabushenko@gmail.com>2020-11-04 18:52:53 +0000
committerGitHub <noreply@github.com>2020-11-04 19:52:53 +0100
commit4c19c5dfae01638ae66fc2c1561762d94fb36a1a (patch)
treec6e17f92352de17c6311d6e3cb6316c0a6614860
parentf17555770e816580b475674be23458da51b10dfd (diff)
downloadNim-4c19c5dfae01638ae66fc2c1561762d94fb36a1a.tar.gz
fix static[Slice[T]] as argument issue (#15842)
-rw-r--r--compiler/sigmatch.nim2
-rw-r--r--tests/types/tisopr.nim12
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 2cf2846c0..d5039fcad 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 1bbd0da94..533cf05be 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)