diff options
author | Clyybber <darkmine956@gmail.com> | 2020-02-11 12:31:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-11 12:31:52 +0100 |
commit | f6d45b40a51d8b336acaae4cddcbca825e11c0ba (patch) | |
tree | 326f8fef1e087d96be9bee844997454104b93083 /lib/core | |
parent | 8100e2e9cdd653da7c3cf70ea84b0713daa3636d (diff) | |
download | Nim-f6d45b40a51d8b336acaae4cddcbca825e11c0ba.tar.gz |
expectLen now shows the length that we got (#13387)
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/macros.nim | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index f97b4a15f..f97cd73ad 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -612,20 +612,20 @@ proc expectMinLen*(n: NimNode, min: int) {.compileTime.} = ## Checks that `n` has at least `min` children. If this is not the case, ## compilation aborts with an error message. This is useful for writing ## macros that check its number of arguments. - if n.len < min: error("macro expects a node with " & $min & " children", n) + if n.len < min: error("Expected a node with at least " & $min & " children, got " & $n.len, n) proc expectLen*(n: NimNode, len: int) {.compileTime.} = ## Checks that `n` has exactly `len` children. If this is not the case, ## compilation aborts with an error message. This is useful for writing ## macros that check its number of arguments. - if n.len != len: error("macro expects a node with " & $len & " children", n) + if n.len != len: error("Expected a node with " & $len & " children, got " & $n.len, n) proc expectLen*(n: NimNode, min, max: int) {.compileTime.} = ## Checks that `n` has a number of children in the range ``min..max``. ## If this is not the case, compilation aborts with an error message. ## This is useful for writing macros that check its number of arguments. if n.len < min or n.len > max: - error("macro expects a node with " & $min & ".." & $max & " children", n) + error("Expected a node with " & $min & ".." & $max & " children, got " & $n.len, n) proc newTree*(kind: NimNodeKind, children: varargs[NimNode]): NimNode {.compileTime.} = |