since now takes an optional patch, eg: since: (1, 3, 1) (#14124)
add tests for tinclrtl
This commit is contained in:
parent
d23446c6ba
commit
9384f7ad35
3 changed files with 51 additions and 3 deletions
|
|
@ -49,8 +49,20 @@ when defined(nimlocks):
|
|||
else:
|
||||
{.pragma: benign, gcsafe.}
|
||||
|
||||
template isSince(version: (int, int)): bool =
|
||||
(NimMajor, NimMinor) >= version
|
||||
template isSince(version: (int, int, int)): bool =
|
||||
(NimMajor, NimMinor, NimPatch) >= version
|
||||
|
||||
template since(version, body: untyped) {.dirty, used.} =
|
||||
## limitation: can't be used to annotate a template (eg typetraits.get), would
|
||||
## Usage:
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## proc fun*() {since: (1, 3).}
|
||||
## proc fun*() {since: (1, 3, 1).}
|
||||
##
|
||||
## Limitation: can't be used to annotate a template (eg typetraits.get), would
|
||||
## error: cannot attach a custom pragma.
|
||||
when (NimMajor, NimMinor) >= version:
|
||||
# `dirty` needed because `NimMajor` may not yet be defined in caller.
|
||||
when isSince(version):
|
||||
body
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue