From ab56220011a0bc83e74fa1bc9a3f38b1e49687ab Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 20 Oct 2022 12:08:51 +0200 Subject: [PATCH] Fix redefinition of 'T`gensymXX' error In rare instances, the Nim compiler will generate the same symbol more than once. Adding a block works around this issue. Reproducing this behavior in a unit test has proved elusive. --- questionable/indexing.nim | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/questionable/indexing.nim b/questionable/indexing.nim index d849c67..e265967 100644 --- a/questionable/indexing.nim +++ b/questionable/indexing.nim @@ -4,8 +4,9 @@ macro `.?`*(expression: typed, brackets: untyped{nkBracket}): untyped = # chain is of shape: expression.?[index] let index = brackets[0] quote do: - type T = typeof(`expression`[`index`]) - try: - `expression`[`index`].some - except KeyError: - T.none + block: + type T = typeof(`expression`[`index`]) + try: + `expression`[`index`].some + except KeyError: + T.none