close #19990; adds a test case (#21853)

This commit is contained in:
ringabout
2023-05-16 03:17:06 +08:00
committed by GitHub
parent cf1ab2a30b
commit ce1ba91573

View File

@@ -45,3 +45,17 @@ proc main() = # todo bug with templates
doAssert b() == @[]
static: main()
main()
type Obj = tuple
value: int
arr: seq[int]
proc bug(): seq[Obj] =
result.add (value: 0, arr: @[])
result[^1].value = 1
result[^1].arr.add 1
# bug #19990
let s = bug()
doAssert s[0] == (value: 1, arr: @[1])