Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

regression from v1.6.12: --styleCheck:error stops checking style for openArray #24269

Closed
tersec opened this issue Oct 9, 2024 · 3 comments · Fixed by #24270
Closed

regression from v1.6.12: --styleCheck:error stops checking style for openArray #24269

tersec opened this issue Oct 9, 2024 · 3 comments · Fixed by #24270

Comments

@tersec
Copy link
Contributor

tersec commented Oct 9, 2024

Description

proc c(_: openarray[int]) = discard

Using
nim c -c --styleCheck:error r

Nim Version

Produces error:

Nim Compiler Version 1.6.12 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 1aa9273640c0c51486cf3a7b67282fe58f360e91
active boot switches: -d:release

Does not produce error:

Nim Compiler Version 1.6.14 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 71ba2e7f3c5815d956b1ae0341b0743242b8fec6
active boot switches: -d:release
Nim Compiler Version 1.6.16 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 3c9b68dc157804885b14a1984efc25e8b7cc861d
active boot switches: -d:release
Nim Compiler Version 1.6.20 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 19fdbfc173bfccb64cb64e0a963e69f52f71fc73
active boot switches: -d:release
Nim Compiler Version 2.0.4 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: b47747d31844c6bd9af4322efe55e24fefea544c
active boot switches: -d:release
Nim Compiler Version 2.0.8 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 5935c3bfa9fec6505394867b23510eb5cbab3dbf
active boot switches: -d:release
Nim Compiler Version 2.0.10 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: e941ee15be775fe3c46db1bed9b4f41c7dfb1334
active boot switches: -d:release
Nim Compiler Version 2.2.0 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 78983f1876726a49c69d65629ab433ea1310ece1
active boot switches: -d:release
Nim Compiler Version 2.2.1 [Linux: amd64]
Compiled at 2024-10-09
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 96d6eee9bc33c22defb980fc0953c8e55f363ab2
active boot switches: -d:release

Current Output

Compilation

Expected Output

Error: 'openarray' should be: 'openArray'

Known Workarounds

No response

Additional Information

No response

@tersec tersec changed the title regression from v.1.6.12: --styleCheck:error stops checking style for openArray regression from v1.6.12: --styleCheck:error stops checking style for openArray Oct 9, 2024
@metagn
Copy link
Collaborator

metagn commented Oct 10, 2024

Knew about this but forgot, this is a regression from #20095, it applies to any symbol from the standard library. The issue is in the lines that do ctx.config.belongsToProjectPackage(sym). It should really do something like ctx.config.belongsToProjectPackage(info.module) but I don't know if this is reliable

@metagn
Copy link
Collaborator

metagn commented Oct 10, 2024

Had to open PRs to packages to fix:

@tersec
Copy link
Contributor Author

tersec commented Oct 10, 2024

Had to open PRs to packages to fix:

* json_rpc: [fix stylecheck for UInt256 status-im/nim-json-rpc#226](https://github.com/status-im/nim-json-rpc/pull/226)

* json_serialization: [fix stylecheck for BiggestUInt status-im/nim-json-serialization#99](https://github.com/status-im/nim-json-serialization/pull/99)

These have both been merged.

@Araq Araq closed this as completed in aaf6c40 Oct 11, 2024
narimiran pushed a commit that referenced this issue Oct 11, 2024
fixes #24269, refs #20095

Instead of checking the package of the *used sym* to determine whether a
stylecheck should trigger, we check the package of the lineinfo instead.
Before #20095 this checked for the current compilation context module
instead which caused issues with generic procs, but the lineinfo should
more closely match the AST.

I figured this might cause issues with includes etc but the foreign
package test specifically tests for an include and passes, so maybe the
package determining logic accounts for this already. This still might
not be the correct logic, I'm not too familiar with the package handling
in the compiler.

Package PRs, both merged:

- json_rpc: status-im/nim-json-rpc#226
- json_serialization:
status-im/nim-json-serialization#99

(cherry picked from commit aaf6c40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants