From 1befb8d4a3559b4611921e851a1fcc64c1b9a17d Mon Sep 17 00:00:00 2001 From: metagn Date: Tue, 20 Aug 2024 17:20:35 +0300 Subject: include generic bodies in allowMetaTypes (#23968) fixes #19848 Not sure why this wasn't the case already. The `if cl.allowMetaTypes: return` line below for `tyFromExpr` [was added 10 years ago](https://github.com/nim-lang/Nim/commit/d5798b43dec547f372eb49d5a8848a9970b12260). Hopefully it was just negligence? --- compiler/semtypinst.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index e87a4939a..276424512 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -573,6 +573,7 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = result.kind = tyUserTypeClassInst of tyGenericBody: + if cl.allowMetaTypes: return localError( cl.c.config, cl.info, @@ -645,7 +646,7 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = for i, resulti in result.ikids: if resulti != nil: - if resulti.kind == tyGenericBody: + if resulti.kind == tyGenericBody and not cl.allowMetaTypes: localError(cl.c.config, if t.sym != nil: t.sym.info else: cl.info, "cannot instantiate '" & typeToString(result[i], preferDesc) & -- cgit 1.4.1-2-gfad0