Skip to content

Commit

Permalink
styleCheck: Fix error for sugar and std/with (#16176)
Browse files Browse the repository at this point in the history
With this commit, we no longer see an error if we pass
`--styleCheck:error` when compiling a file that contains `import sugar`
or `import std/with`.

The problem was that those modules (and only those modules) import
`std/private/underscored_calls`, which contained a styleCheck issue:
its spelling of `nnkArgList` didn't match the `nnkArglist` spelling in
`macros.nim`.

This commit fixes the issue by renaming `nnkArgList` to `nnkArglist`
repo-wide. The other way around would be a breaking change for code that
used `nnkArglist` and `--styleCheck:error`.

Fixes: #16174
  • Loading branch information
ee7 authored Dec 2, 2020
1 parent 139075e commit 629b22e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion doc/manual_experimental.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ all the arguments, but also the matched operators in reverse polish notation:
echo x + y * z - x
This passes the expression ``x + y * z - x`` to the ``optM`` macro as
an ``nnkArgList`` node containing::
an ``nnkArglist`` node containing::

Arglist
Sym "x"
Expand Down
2 changes: 1 addition & 1 deletion lib/std/private/underscored_calls.nim
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ proc underscoredCall(n, arg0: NimNode): NimNode =
result.add arg0

proc underscoredCalls*(result, calls, arg0: NimNode) =
expectKind calls, {nnkArgList, nnkStmtList, nnkStmtListExpr}
expectKind calls, {nnkArglist, nnkStmtList, nnkStmtListExpr}

for call in calls:
if call.kind in {nnkStmtList, nnkStmtListExpr}:
Expand Down
2 changes: 1 addition & 1 deletion tests/astspec/tastspec.nim
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ static:
(x & y & z) is string

ast.peelOff({nnkStmtList, nnkTypeSection}).matchAst:
of nnkTypeDef(_, _, nnkTypeClassTy(nnkArgList, _, _, nnkStmtList)):
of nnkTypeDef(_, _, nnkTypeClassTy(nnkArglist, _, _, nnkStmtList)):
# note this isn't nnkConceptTy!
echo "ok"

Expand Down

0 comments on commit 629b22e

Please sign in to comment.