From d18580bb689f09f3f2d8e33f946d3b508d6a9a6e Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 6 May 2021 17:28:58 +0200 Subject: [PATCH] Better error message when adding a void result to a .? chain --- questionable/chaining.nim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/questionable/chaining.nim b/questionable/chaining.nim index 7c8ca14..3373a0d 100644 --- a/questionable/chaining.nim +++ b/questionable/chaining.nim @@ -9,6 +9,8 @@ func expectSym(node: NimNode) = template `.?`*(option: typed, identifier: untyped{nkIdent}): untyped = # chain is of shape: option.?identifier + when not compiles(typeof(option.unsafeGet.identifier)): + {.error: ".? chain cannot return void".} option ->? option.unsafeGet.identifier macro `.?`*(option: typed, infix: untyped{nkInfix}): untyped =