summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2024-05-08 23:10:48 +0800
committerGitHub <noreply@github.com>2024-05-08 09:10:48 -0600
commit1ad4e80060f22275b2f443bd8630e2573619e487 (patch)
tree17cf956cefb8170c1a237fd25f56edf2b50fd7c5 /compiler
parent6cc783f7f363a4cecd390563ca4fa1780c9af9d1 (diff)
downloadNim-1ad4e80060f22275b2f443bd8630e2573619e487.tar.gz
fixes #22409; don't check style for enumFieldSymChoice in the function (#23580)
fixes #22409
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semexprs.nim6
-rw-r--r--compiler/sigmatch.nim2
-rw-r--r--compiler/suggest.nim5
3 files changed, 7 insertions, 6 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 17a3082ff..d7452c156 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -2989,7 +2989,7 @@ proc getNilType(c: PContext): PType =
     result.align = c.config.target.ptrSize.int16
     c.nilTypeCache = result
 
-proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym): PNode =
+proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym; flags: TExprFlags): PNode =
   var o: TOverloadIter = default(TOverloadIter)
   var i = 0
   var a = initOverloadIter(o, c, n)
@@ -3002,7 +3002,7 @@ proc enumFieldSymChoice(c: PContext, n: PNode, s: PSym): PNode =
   if i <= 1:
     if sfGenSym notin s.flags:
       result = newSymNode(s, info)
-      markUsed(c, info, s)
+      markUsed(c, info, s, efInCall notin flags)
       onUse(info, s)
     else:
       result = n
@@ -3126,7 +3126,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}, expectedType: PType
       if optOwnedRefs in c.config.globalOptions:
         result.typ = makeVarType(c, result.typ, tyOwned)
     of skEnumField:
-      result = enumFieldSymChoice(c, n, s)
+      result = enumFieldSymChoice(c, n, s, flags)
     else:
       result = semSym(c, n, s, flags)
     if isSymChoice(result):
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim
index 30ce24500..242dd4ec6 100644
--- a/compiler/sigmatch.nim
+++ b/compiler/sigmatch.nim
@@ -96,7 +96,7 @@ type
 const
   isNilConversion = isConvertible # maybe 'isIntConv' fits better?
 
-proc markUsed*(c: PContext; info: TLineInfo, s: PSym)
+proc markUsed*(c: PContext; info: TLineInfo, s: PSym; checkStyle = true)
 proc markOwnerModuleAsUsed*(c: PContext; s: PSym)
 
 template hasFauxMatch*(c: TCandidate): bool = c.fauxMatch != tyNone
diff --git a/compiler/suggest.nim b/compiler/suggest.nim
index 616ecd466..a5213086b 100644
--- a/compiler/suggest.nim
+++ b/compiler/suggest.nim
@@ -696,7 +696,7 @@ proc markOwnerModuleAsUsed(c: PContext; s: PSym) =
       else:
         inc i
 
-proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
+proc markUsed(c: PContext; info: TLineInfo; s: PSym; checkStyle = true) =
   let conf = c.config
   incl(s.flags, sfUsed)
   if s.kind == skEnumField and s.owner != nil:
@@ -713,7 +713,8 @@ proc markUsed(c: PContext; info: TLineInfo; s: PSym) =
     if sfError in s.flags: userError(conf, info, s)
   when defined(nimsuggest):
     suggestSym(c.graph, info, s, c.graph.usageSym, false)
-  styleCheckUse(c, info, s)
+  if checkStyle:
+    styleCheckUse(c, info, s)
   markOwnerModuleAsUsed(c, s)
 
 proc safeSemExpr*(c: PContext, n: PNode): PNode =