summary refs log tree commit diff stats
path: root/compiler/lookups.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2021-07-28 12:46:28 +0200
committerGitHub <noreply@github.com>2021-07-28 12:46:28 +0200
commita273ea70e8817e3509014a1b3dcd16a360ed400b (patch)
tree3a3d26701cf7bc84240426cde277d44e6194e4a4 /compiler/lookups.nim
parent4c1202972abdfe99232e5d15a6169c7b2e0f5d75 (diff)
downloadNim-a273ea70e8817e3509014a1b3dcd16a360ed400b.tar.gz
implements overloadable enum values; WIP (#18470)
* implements overloadable enum values
* simpler code
Diffstat (limited to 'compiler/lookups.nim')
-rw-r--r--compiler/lookups.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim
index 44a30eefa..331eef525 100644
--- a/compiler/lookups.nim
+++ b/compiler/lookups.nim
@@ -177,13 +177,16 @@ iterator allSyms*(c: PContext): (PSym, int, bool) =
 
 proc someSymFromImportTable*(c: PContext; name: PIdent; ambiguous: var bool): PSym =
   var marked = initIntSet()
+  var symSet = OverloadableSyms
+  if overloadableEnums notin c.features:
+    symSet.excl skEnumField
   result = nil
   for im in c.imports.mitems:
     for s in symbols(im, marked, name, c.graph):
       if result == nil:
         result = s
       else:
-        if s.kind notin OverloadableSyms or result.kind notin OverloadableSyms:
+        if s.kind notin symSet or result.kind notin symSet:
           ambiguous = true
 
 proc searchInScopes*(c: PContext, s: PIdent; ambiguous: var bool): PSym =
@@ -384,7 +387,7 @@ proc mergeShadowScope*(c: PContext) =
   ##
   ## Merges:
   ## shadow -> shadow: add symbols to the parent but check for redefinitions etc
-  ## shadow -> non-shadow: the above, but also handle exports and all that 
+  ## shadow -> non-shadow: the above, but also handle exports and all that
   let shadowScope = c.currentScope
   c.rawCloseScope
   for sym in shadowScope.symbols: