From ba516c8eb574a113129f2684dc3101a3adc3ff6a Mon Sep 17 00:00:00 2001 From: metagn Date: Tue, 20 Aug 2024 17:20:35 +0300 Subject: [PATCH] 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? (cherry picked from commit 1befb8d4a3559b4611921e851a1fcc64c1b9a17d) --- compiler/semtypinst.nim | 3 ++- tests/generics/t19848.nim | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/generics/t19848.nim diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index 61a74a9710..2bd769ef6a 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -578,6 +578,7 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = result.kind = tyUserTypeClassInst of tyGenericBody: + if cl.allowMetaTypes: return localError( cl.c.config, cl.info, @@ -651,7 +652,7 @@ proc replaceTypeVarsTAux(cl: var TReplTypeVars, t: PType): PType = for i in 0..