From 1025122a700381c59452d0f1918f6b837a880625 Mon Sep 17 00:00:00 2001 From: metagn Date: Thu, 18 Jul 2024 15:20:15 -0600 Subject: [PATCH] fix generics treating symchoice symbols as uninstantiated fixes #23853 --- compiler/semtypinst.nim | 6 ++- tests/generics/t23853.nim | 91 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/generics/t23853.nim diff --git a/compiler/semtypinst.nim b/compiler/semtypinst.nim index f0ce8d76f0c7..e87a4939a2f1 100644 --- a/compiler/semtypinst.nim +++ b/compiler/semtypinst.nim @@ -132,9 +132,13 @@ proc prepareNode(cl: var TReplTypeVars, n: PNode): PNode = else: replaceTypeVarsS(cl, n.sym, replaceTypeVarsT(cl, n.sym.typ)) let isCall = result.kind in nkCallKinds + # don't try to instantiate symchoice symbols, they can be + # generic procs which the compiler will think are uninstantiated + # because their type will contain uninstantiated params + let isSymChoice = result.kind in nkSymChoices for i in 0..