mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 01:44:37 +00:00
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: https://github.com/status-im/nim-json-rpc/pull/226 - json_serialization: https://github.com/status-im/nim-json-serialization/pull/99
26 lines
800 B
Nim
26 lines
800 B
Nim
discard """
|
|
matrix: "--errorMax:0 --styleCheck:error"
|
|
action: compile
|
|
"""
|
|
|
|
import foreign_package/foreign_package
|
|
|
|
# This call tests that:
|
|
# - an instantiation of a generic in a foreign package doesn't raise errors
|
|
# when the generic body contains:
|
|
# - definition and usage violations
|
|
# - builtin pragma usage violations
|
|
# - user pragma usage violations
|
|
# - definition violations in foreign packages are ignored
|
|
# - usage violations in foreign packages are ignored
|
|
generic_proc[int]()
|
|
# issue #24269, stdlib:
|
|
proc c(_: openArray[int]) = discard
|
|
static:
|
|
doAssert compiles(generic_proc[int]())
|
|
doAssert not compiles(genericProc[int]())
|
|
doAssert not (compiles do:
|
|
proc c(_: openarray[int]) = discard)
|
|
doAssert (compiles do:
|
|
proc d(_: openArray[int]) = discard)
|