mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* manual: Document the use of `static` as a proc call Also adds tests. Fixes https://github.com/nim-lang/Nim/issues/16987 . * Update doc/manual.rst Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * Use the "bug #NNNN" comment syntax for consistency Ref: https://nim-lang.github.io/Nim/contributing.html#writing-tests-stdlib > Always refer to a GitHub issue using the following exact syntax: bug for tooling. * manual: Undocument usage of foo.static foo.static and foo.static() are not expected to work. Ref: https://github.com/nim-lang/Nim/pull/19084/files#r741203578 Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
13 lines
332 B
Nim
13 lines
332 B
Nim
# bug #16987
|
|
|
|
proc getNum(a: int): int = a
|
|
|
|
# Below calls "doAssert getNum(123) == 123" at compile time.
|
|
static:
|
|
doAssert getNum(123) == 123
|
|
|
|
# Below calls evaluate the "getNum(123)" at compile time, but the
|
|
# results of those calls get used at run time.
|
|
doAssert (static getNum(123)) == 123
|
|
doAssert (static(getNum(123))) == 123
|