Add testcase for #14383 (#14957)

This commit is contained in:
Clyybber 2020-07-10 18:10:32 +02:00 • committed by GitHub
commit 1850efbb6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions

23
tests/arc/dmodule.nim Normal file
View file

@ -0,0 +1,23 @@
type
MinKind* = enum
minDictionary
minBool
MinValue* = object
case kind*: MinKind
of minDictionary:
symbols: seq[MinOperator]
else: discard
MinOperator = object
# remove this inline pragma to make it compile
proc `$`*(a: MinValue): string {.inline.} =
case a.kind
of minDictionary:
result = "hello"
for i in a.symbols:
result = "hello"
else: discard
proc parseMinValue*(): MinValue =
# or this echo
echo result

13
tests/arc/t14383.nim Normal file
View file

@ -0,0 +1,13 @@
discard """
cmd: "nim c --gc:arc $file"
output: '''
hello
hello
'''
"""
import dmodule
var val = parseMinValue()
if val.kind == minDictionary:
echo val