diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-03-10 16:28:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 09:28:51 +0100 |
commit | 03198243227a076d6d758bdcf004d007dc8f9980 (patch) | |
tree | fe5d1a4f35ae2b42805064fae99e441f86ae8b6f /tests/arc | |
parent | 72e262666bdf2bb3c239183dd32b48bb05d113aa (diff) | |
download | Nim-03198243227a076d6d758bdcf004d007dc8f9980.tar.gz |
fixes #21023; Segfault when mixing seqs, orc, variants and futures (#21497)
* fixes #21023; Segfault when mixing seqs, orc, variants and futures * fixes none of the branches were explicitly selected * add one more test * one more test
Diffstat (limited to 'tests/arc')
-rw-r--r-- | tests/arc/tcaseobj.nim | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/arc/tcaseobj.nim b/tests/arc/tcaseobj.nim index d52833e4d..26c122384 100644 --- a/tests/arc/tcaseobj.nim +++ b/tests/arc/tcaseobj.nim @@ -269,3 +269,64 @@ proc bug20305 = echo x.pChildren bug20305() + +# bug #21023 +block: + block: + type + MGErrorKind = enum + mgeUnexpected, mgeNotFound + + type Foo = object + kind: MGErrorKind + ex: Exception + + type Boo = object + a: seq[int] + + type + Result2 = object + case o: bool + of false: + e: Foo + of true: + v: Boo + + proc startSessionSync(): Result2 = + return Result2(o: true) + + proc mainSync = + let ff = startSessionSync() + doAssert ff.o == true + + mainSync() + + block: + type + MGErrorKind = enum + mgeUnexpected, mgeNotFound + + type Foo = object + kind: MGErrorKind + ex: Exception + + type Boo = object + a: seq[int] + + type + Result2 = object + case o: bool + of false: + e: Foo + of true: + v: Boo + s: int + + proc startSessionSync(): Result2 = + return Result2(o: true, s: 12) + + proc mainSync = + let ff = startSessionSync() + doAssert ff.s == 12 + + mainSync() |