summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-10-07 15:07:24 +0200
committerGitHub <noreply@github.com>2021-10-07 15:07:24 +0200
commit6f15af41a7ea7aeb09b9c9b9c1d7ca3b505107c9 (patch)
tree572f7db591385ca5751bc2d1e4b4178e7e7a222a /compiler
parent19774a72e7fcc7c5b7649bb956b149362c05ea15 (diff)
downloadNim-6f15af41a7ea7aeb09b9c9b9c1d7ca3b505107c9.tar.gz
fixes a regression caused by overloadable enums even though they're opt-in (#18970)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semtempl.nim10
1 files changed, 7 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)