fixes #19967; reset does not work on set [backport: 1.2] (#19968)

* fixes #19967

* use case

* add testcase

* fix typos

* explictly specify other branches

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
This commit is contained in:
ringabout
2022-08-24 00:38:12 +08:00
committed by GitHub
parent 32e4b33632
commit e8556b45f5
2 changed files with 41 additions and 1 deletions

View File

@@ -74,3 +74,30 @@ template main =
static: main()
main()
# bug #19967
block:
type
X = object
a: string
b: set[char]
var y = X(b: {'a'})
reset(y)
doAssert y.b == {}
block:
type
Color = enum
Red, Blue, Yellow
X = object
a: string
b: set[Color]
var y = X(b: {Red, Blue})
reset(y)
doAssert y.b == {}