summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/sigmatch.nim2
-rw-r--r--tests/types/tyet_another_generic_regression.nim13
2 files changed, 14 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 31714b7bf..3d0b0ed3d 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -1385,7 +1385,7 @@ proc typeRelImpl(c: var TCandidate, f, aOrig: PType,
     # XXX: This is very hacky. It should be moved back into liftTypeParam
     if x.kind in {tyGenericInst, tyArray} and
        c.calleeSym != nil and
-       c.calleeSym.kind in {skProc, skFunc}:
+       c.calleeSym.kind in {skProc, skFunc} and c.call != nil:
       let inst = prepareMetatypeForSigmatch(c.c, c.bindings, c.call.info, f)
       return typeRel(c, inst, a)
 
diff --git a/tests/types/tyet_another_generic_regression.nim b/tests/types/tyet_another_generic_regression.nim
new file mode 100644
index 000000000..914166e06
--- /dev/null
+++ b/tests/types/tyet_another_generic_regression.nim
@@ -0,0 +1,13 @@
+import system
+
+type Bar[T] = ref object
+ value: T
+
+type types = int32|int64 # if I change this to just int32 or int64 it works (compiles)
+
+# if I replace Bar everywhere with seq it also compiles fine
+proc Foo[T: Bar[types]](): T =
+ when T is Bar: nil
+
+discard Foo[Bar[int32]]()
+#bug #6073