fixes #2637
This commit is contained in:
parent
732bdd54a0
commit
8507f95d68
2 changed files with 60 additions and 38 deletions
30
tests/ccgbugs/twrong_discriminant_check.nim
Normal file
30
tests/ccgbugs/twrong_discriminant_check.nim
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
discard """
|
||||
output: "(kind: None)"
|
||||
"""
|
||||
|
||||
when true:
|
||||
# bug #2637
|
||||
|
||||
type
|
||||
OptionKind = enum
|
||||
None,
|
||||
Some
|
||||
|
||||
Option*[T] = object
|
||||
case kind: OptionKind
|
||||
of None:
|
||||
discard
|
||||
of Some:
|
||||
value*: T
|
||||
|
||||
proc none*[T](): Option[T] =
|
||||
Option[T](kind: None)
|
||||
|
||||
proc none*(T: typedesc): Option[T] = none[T]()
|
||||
|
||||
|
||||
proc test(): Option[int] =
|
||||
int.none
|
||||
|
||||
echo test()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue