From 1850efbb6c618946da7c943b153f7caa9a66ba33 Mon Sep 17 00:00:00 2001 From: Clyybber Date: Fri, 10 Jul 2020 18:10:32 +0200 Subject: [PATCH] Add testcase for #14383 (#14957) --- tests/arc/dmodule.nim | 23 +++++++++++++++++++++++ tests/arc/t14383.nim | 13 +++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/arc/dmodule.nim create mode 100644 tests/arc/t14383.nim diff --git a/tests/arc/dmodule.nim b/tests/arc/dmodule.nim new file mode 100644 index 0000000000..455ec70846 --- /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 0000000000..115cbf426b --- /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