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

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