summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/semtempl.nim10
-rw-r--r--tests/enum/mregression.nim4
-rw-r--r--tests/enum/tregression.nim13
3 files changed, 24 insertions, 3 deletions
diff --git a/compiler/semtempl.nim b/compiler/semtempl.nim
index c10917bcb..49ce55a64 100644
--- a/compiler/semtempl.nim
+++ b/compiler/semtempl.nim
@@ -250,7 +250,7 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
   of skUnknown:
     # Introduced in this pass! Leave it as an identifier.
     result = n
-  of OverloadableSyms:
+  of OverloadableSyms-{skEnumField}:
     result = symChoice(c, n, s, scOpen, isField)
   of skGenericParam:
     if isField and sfGenSym in s.flags: result = n
@@ -261,8 +261,12 @@ proc semTemplSymbol(c: PContext, n: PNode, s: PSym; isField: bool): PNode =
     if isField and sfGenSym in s.flags: result = n
     else: result = newSymNodeTypeDesc(s, c.idgen, n.info)
   else:
-    if isField and sfGenSym in s.flags: result = n
-    else: result = newSymNode(s, n.info)
+    if s.kind == skEnumField and overloadableEnums in c.features:
+      result = symChoice(c, n, s, scOpen, isField)
+    elif isField and sfGenSym in s.flags:
+      result = n
+    else:
+      result = newSymNode(s, n.info)
     # Issue #12832
     when defined(nimsuggest):
       suggestSym(c.graph, n.info, s, c.graph.usageSym, false)
diff --git a/tests/enum/mregression.nim b/tests/enum/mregression.nim
new file mode 100644
index 000000000..9c3e3cf8b
--- /dev/null
+++ b/tests/enum/mregression.nim
@@ -0,0 +1,4 @@
+
+type
+  OtherEnum* = enum
+    Success, Failed, More
diff --git a/tests/enum/tregression.nim b/tests/enum/tregression.nim
new file mode 100644
index 000000000..597f0c80a
--- /dev/null
+++ b/tests/enum/tregression.nim
@@ -0,0 +1,13 @@
+discard """
+  action: "compile"
+"""
+import options, mregression
+
+type
+  MyEnum = enum
+    Success
+
+template t =
+  echo some(Success)
+
+t()