results: work around void member codegen issue (#150)
This commit is contained in:
parent
989047dd76
commit
8a1b6ab4dc
|
@ -304,6 +304,30 @@ type
|
||||||
## https://github.com/nim-lang/Nim/issues/13879 - double-zero-init slow
|
## https://github.com/nim-lang/Nim/issues/13879 - double-zero-init slow
|
||||||
## https://github.com/nim-lang/Nim/issues/14318 - generic error raises pragma
|
## https://github.com/nim-lang/Nim/issues/14318 - generic error raises pragma
|
||||||
|
|
||||||
|
# TODO https://github.com/nim-lang/Nim/issues/20699
|
||||||
|
# case o: bool
|
||||||
|
# of false:
|
||||||
|
# e: E
|
||||||
|
# of true:
|
||||||
|
# v: T
|
||||||
|
|
||||||
|
when T is void:
|
||||||
|
when E is void:
|
||||||
|
o: bool
|
||||||
|
else:
|
||||||
|
case o: bool
|
||||||
|
of false:
|
||||||
|
e: E
|
||||||
|
of true:
|
||||||
|
discard
|
||||||
|
else:
|
||||||
|
when E is void:
|
||||||
|
case o: bool
|
||||||
|
of false:
|
||||||
|
discard
|
||||||
|
of true:
|
||||||
|
v: T
|
||||||
|
else:
|
||||||
case o: bool
|
case o: bool
|
||||||
of false:
|
of false:
|
||||||
e: E
|
e: E
|
||||||
|
|
|
@ -403,3 +403,15 @@ block: # Experiments
|
||||||
counter2 += 1
|
counter2 += 1
|
||||||
|
|
||||||
doAssert counter2 == 1, "one-item collection when set"
|
doAssert counter2 == 1, "one-item collection when set"
|
||||||
|
|
||||||
|
block: # Constants
|
||||||
|
# TODO https://github.com/nim-lang/Nim/issues/20699
|
||||||
|
type
|
||||||
|
WithOpt = object
|
||||||
|
opt: Opt[int]
|
||||||
|
const
|
||||||
|
noneWithOpt =
|
||||||
|
WithOpt(opt: Opt.none(int))
|
||||||
|
proc checkIt(v: WithOpt) =
|
||||||
|
doAssert v.opt.isNone()
|
||||||
|
checkIt(noneWithOpt)
|
||||||
|
|
Loading…
Reference in New Issue