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/objects/tobject_default_value.nim | |
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/objects/tobject_default_value.nim')
-rw-r--r-- | tests/objects/tobject_default_value.nim | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/objects/tobject_default_value.nim b/tests/objects/tobject_default_value.nim index 150fb0876..59af943e0 100644 --- a/tests/objects/tobject_default_value.nim +++ b/tests/objects/tobject_default_value.nim @@ -559,6 +559,38 @@ template main {.dirty.} = let x = default(Default) doAssert x.data is DjangoDateTime + block: + type + Result2 = object + case o: bool + of false: + e: float + of true: + v {.requiresInit.} : int = 1 + + proc startSessionSync(): Result2 = + return Result2(o: true) + + proc mainSync = + let ff = startSessionSync() + doAssert ff.v == 1 + + mainSync() + + block: + type + Result2 = object + v {.requiresInit.} : int = 1 + + proc startSessionSync(): Result2 = + return Result2() + + proc mainSync = + let ff = startSessionSync() + doAssert ff.v == 1 + + mainSync() + static: main() main() |