diff options
author | Clyybber <darkmine956@gmail.com> | 2020-07-10 18:10:32 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-10 18:10:32 +0200 |
commit | 1850efbb6c618946da7c943b153f7caa9a66ba33 (patch) | |
tree | 10ada1f6d7a039f8f10b2f25d022276efb942dee /tests | |
parent | db6ffeba8e8be9d27a8c4610952b0424e9c46d4a (diff) | |
download | Nim-1850efbb6c618946da7c943b153f7caa9a66ba33.tar.gz |
Add testcase for #14383 (#14957)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/arc/dmodule.nim | 23 | ||||
-rw-r--r-- | tests/arc/t14383.nim | 13 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/arc/dmodule.nim b/tests/arc/dmodule.nim new file mode 100644 index 000000000..455ec7084 --- /dev/null +++ b/tests/arc/dmodule.nim @@ -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 diff --git a/tests/arc/t14383.nim b/tests/arc/t14383.nim new file mode 100644 index 000000000..115cbf426 --- /dev/null +++ b/tests/arc/t14383.nim @@ -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 |