Skip to content

Commit 86011b3

Browse files
committed
tests: add a regression test
1 parent 737f533 commit 86011b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/lang_objects/objects/tobjects_issues.nim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,18 @@ block t3038:
115115
data: Data[T]
116116
SubSubType = ref object of SubType[int]
117117
SubSubSubType = ref object of SubSubType
118+
119+
block recursive_type_with_alias_bug:
120+
# regression test for edge case issue with recursive object types and aliases
121+
type
122+
Alias = Obj
123+
Obj = object
124+
x: ref Alias
125+
126+
proc test() =
127+
# the `Obj` usage has to appear first...
128+
var x = Obj(x: nil)
129+
# ... the usage of the alias type has to appear second
130+
var y = Alias(x: nil)
131+
132+
test()

0 commit comments

Comments
 (0)