summary refs log tree commit diff stats
path: root/compiler/semobjconstr.nim
diff options
context:
space:
mode:
authorJuan M Gómez <info@jmgomez.me>2023-06-16 07:23:25 +0100
committerGitHub <noreply@github.com>2023-06-16 08:23:25 +0200
commitb4d9be0f8ae6c97d581e3d32f502a3c323f18475 (patch)
tree36a0637d73b6041cbf12eaa1c8218652b56d8cf0 /compiler/semobjconstr.nim
parent0a19d78b228a2d2e7b5e2341edf45b5ee669196a (diff)
downloadNim-b4d9be0f8ae6c97d581e3d32f502a3c323f18475.tar.gz
fixes ilegal recursion (#22105)
Diffstat (limited to 'compiler/semobjconstr.nim')
-rw-r--r--compiler/semobjconstr.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semobjconstr.nim b/compiler/semobjconstr.nim
index 28471f016..d4eba2112 100644
--- a/compiler/semobjconstr.nim
+++ b/compiler/semobjconstr.nim
@@ -376,7 +376,9 @@ proc semConstructTypeAux(c: PContext,
     if status in {initPartial, initNone, initUnknown}:
       discard collectMissingFields(c, t.n, constrCtx, result.defaults)
     let base = t[0]
-    if base == nil: break
+    if base == nil or base.id == t.id or 
+      base.kind in { tyRef, tyPtr } and base[0].id == t.id: 
+        break
     t = skipTypes(base, skipPtrs)
     if t.kind != tyObject:
       # XXX: This is not supposed to happen, but apparently