summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2022-09-20 06:31:40 +0800
committerGitHub <noreply@github.com>2022-09-19 18:31:40 -0400
commita302b26e0eaa7a2074d3caac72f7c8a7e79993c5 (patch)
tree5e706d564166045885aebc7c9806b7f567d84be9 /compiler
parentc4ba4f06f819d6356fff8ee8ee1df0392091de9a (diff)
downloadNim-a302b26e0eaa7a2074d3caac72f7c8a7e79993c5.tar.gz
fix #19882 Improve error message when instantiating generics that lac… (#20356)
* fix #19882 Improve error message when instantiating generics that lack a type

* Update tests/errmsgs/t19882.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
Diffstat (limited to 'compiler')
-rw-r--r--compiler/seminst.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/seminst.nim b/compiler/seminst.nim
index f5810c814..bd5eb1ec3 100644
--- a/compiler/seminst.nim
+++ b/compiler/seminst.nim
@@ -54,7 +54,8 @@ iterator instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable): PSym
           # later by semAsgn in return type inference scenario
           t = q.typ
         else:
-          localError(c.config, a.info, errCannotInstantiateX % s.name.s)
+          if q.typ.kind != tyCompositeTypeClass:
+            localError(c.config, a.info, errCannotInstantiateX % s.name.s)
           t = errorType(c)
       elif t.kind in {tyGenericParam, tyConcept}:
         localError(c.config, a.info, errCannotInstantiateX % q.name.s)