summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/sigmatch.nim5
-rw-r--r--tests/generics/t8270.nim7
2 files changed, 11 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 4bac3d3ea..7e9143d94 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -569,7 +569,10 @@ proc procParamTypeRel(c: var TCandidate, f, a: PType): TTypeRelation =
       # signature. There is a change that the target
       # type is already fully-determined, so we are
       # going to try resolve it
-      f = generateTypeInstance(c.c, c.bindings, c.call.info, f)
+      if c.call != nil:
+        f = generateTypeInstance(c.c, c.bindings, c.call.info, f)
+      else:
+        f = nil
       if f == nil or f.isMetaType:
         # no luck resolving the type, so the inference fails
         return isBothMetaConvertible
diff --git a/tests/generics/t8270.nim b/tests/generics/t8270.nim
new file mode 100644
index 000000000..707e981fa
--- /dev/null
+++ b/tests/generics/t8270.nim
@@ -0,0 +1,7 @@
+discard """
+  line: 6
+  errormsg: "cannot instantiate: \'T\'"
+"""
+
+proc m[T](x: T): int = discard
+echo [m]