Skip to content

Commit 00775f6

Browse files
authored
fix stylecheck bug with nre (#19356)
* stylecheck usages part two: stdlib cleanup typeinfo.nim: importCompilerProc => importcompilerproc nre.nim: newLineFlags => newlineFlags system.nim: JSRoot => JsRoot ref #19319 * prefer importCompilerProc * fix stylecheck error with asyncdispatch it is a partial regression since #12842 * add tests * don't use echo in tests * fix stylecheck bug with nre * Update compiler/linter.nim * no need to check dotexpr again * neither did let/var/const
1 parent e78ef57 commit 00775f6

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

compiler/semexprs.nim

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,8 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
11881188
let s = getGenSym(c, sym)
11891189
case s.kind
11901190
of skConst:
1191-
markUsed(c, n.info, s)
1191+
if n.kind != nkDotExpr: # dotExpr is already checked by builtinFieldAccess
1192+
markUsed(c, n.info, s)
11921193
onUse(n.info, s)
11931194
let typ = skipTypes(s.typ, abstractInst-{tyTypeDesc})
11941195
case typ.kind
@@ -1249,7 +1250,8 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
12491250
if s.magic == mNimvm:
12501251
localError(c.config, n.info, "illegal context for 'nimvm' magic")
12511252

1252-
markUsed(c, n.info, s)
1253+
if n.kind != nkDotExpr: # dotExpr is already checked by builtinFieldAccess
1254+
markUsed(c, n.info, s)
12531255
onUse(n.info, s)
12541256
result = newSymNode(s, n.info)
12551257
# We cannot check for access to outer vars for example because it's still
@@ -1270,7 +1272,8 @@ proc semSym(c: PContext, n: PNode, sym: PSym, flags: TExprFlags): PNode =
12701272
n.typ = s.typ
12711273
return n
12721274
of skType:
1273-
markUsed(c, n.info, s)
1275+
if n.kind != nkDotExpr: # dotExpr is already checked by builtinFieldAccess
1276+
markUsed(c, n.info, s)
12741277
onUse(n.info, s)
12751278
if s.typ.kind == tyStatic and s.typ.base.kind != tyNone and s.typ.n != nil:
12761279
return s.typ.n

tests/stylecheck/taccept.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ discard """
22
matrix: "--styleCheck:error --styleCheck:usages"
33
"""
44

5-
import asyncdispatch
5+
import std/[asyncdispatch, nre]
66

77
type
88
Name = object

0 commit comments

Comments
 (0)