From f765898a7518f5c6bbebffd4217ccc35fd02747d Mon Sep 17 00:00:00 2001 From: SirOlaf <34164198+SirOlaf@users.noreply.github.com> Date: Wed, 17 Jul 2024 23:54:15 +0200 Subject: Set type of object constructor during annotateType (#23852) Fix https://github.com/nim-lang/Nim/issues/23547 Tested locally with the included test, the test from constantine and the original issue. --- compiler/semmacrosanity.nim | 1 + tests/macros/t23547.nim | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/macros/t23547.nim diff --git a/compiler/semmacrosanity.nim b/compiler/semmacrosanity.nim index 4aab216c7..727f36470 100644 --- a/compiler/semmacrosanity.nim +++ b/compiler/semmacrosanity.nim @@ -51,6 +51,7 @@ proc annotateType*(n: PNode, t: PType; conf: ConfigRef) = of nkObjConstr: let x = t.skipTypes(abstractPtrs) n.typ = t + n[0].typ = t for i in 1..