From 21bd00b23eed33e13793f35ccf3a422144e30759 Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Thu, 21 Nov 2024 22:44:09 +0800 Subject: [PATCH] adds a test case --- tests/ccgbugs/tsamename3.nim | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/ccgbugs/tsamename3.nim b/tests/ccgbugs/tsamename3.nim index ded18e9f8faf..99bfa5334bff 100644 --- a/tests/ccgbugs/tsamename3.nim +++ b/tests/ccgbugs/tsamename3.nim @@ -118,3 +118,24 @@ block: # issue #22571 foo: type Foo = object doAssert $Foo() == "()" + +block: # bug #7784 + block: + type + Color = enum clrBlack, clrRed, clrGreen, clrBlue + + var color = clrRed + doAssert(ord(color) == 1) + doAssert($color == "clrRed") + + block: + type + Color = enum + clrBlack = "Black", + clrRed = "Red", + clrGreen = "Green", + clrBlue = "Blue" + + var color = clrRed + doAssert(ord(color) == 1) + doAssert($color == "Red")