summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorSirOlaf <34164198+SirOlaf@users.noreply.github.com>2023-09-07 05:46:45 +0200
committerGitHub <noreply@github.com>2023-09-07 05:46:45 +0200
commitee4a219012ca1fcb2cfb2cce4e87ff6774009d86 (patch)
treec2118b04b1cc64ff3769642928f37d0eed6bea39 /tests
parenta4df44d9fbe3328b2dd3b7209b98f80fdd5d361a (diff)
downloadNim-ee4a219012ca1fcb2cfb2cce4e87ff6774009d86.tar.gz
Fix #17509: Continue instead of return with unfinished generics (#22563)
Close #17509

Current knowledge:
- delaying cache fixes the issue
- changing return of `if inst.len < key.len:` in `searchInstTypes` to
`continue` fixes the issue. With return the broken types are also cached
over and over

Related issues are completely unaffected as of now, so there must be
something deeper.

I am also still trying to find the true cause, so feel free to ignore
for now

---------

Co-authored-by: SirOlaf <>
Diffstat (limited to 'tests')
-rw-r--r--tests/generics/t17509.nim25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/generics/t17509.nim b/tests/generics/t17509.nim
new file mode 100644
index 000000000..89f507577
--- /dev/null
+++ b/tests/generics/t17509.nim
@@ -0,0 +1,25 @@
+type List[O] = object
+  next: ptr List[O]
+
+proc initList[O](l: ptr List[O]) =
+  l[].next = l
+
+type
+  PolytopeVertex[R] = object
+    list: List[PolytopeVertex[R]]
+
+  PolytopeEdge[R] = object
+    list: List[PolytopeEdge[R]]
+
+  Polytope[R] = object
+    vertices: List[PolytopeVertex[R]]
+    edges: List[PolytopeEdge[R]]
+
+var pt: Polytope[float]
+
+static:
+  doAssert pt.vertices.next is (ptr List[PolytopeVertex[float]])
+  doAssert pt.edges.next is (ptr List[PolytopeEdge[float]])
+
+initList(addr pt.vertices)
+initList(addr pt.edges)
\ No newline at end of file