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
This commit is contained in:
ringabout 2023-03-10 16:28:51 +08:00 • committed by GitHub
commit 0319824322
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 136 additions and 18 deletions

View file

@ -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()