From f003557674d862ea5d78192d6fbcec6f9d1ff413 Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Sat, 23 May 2020 19:55:55 +0300 Subject: [PATCH] typedParams will now handle parameters with pragmas --- stew/shims/macros.nim | 2 +- tests/test_objects.nim | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/stew/shims/macros.nim b/stew/shims/macros.nim index 9aaf52f..26bd0b4 100644 --- a/stew/shims/macros.nim +++ b/stew/shims/macros.nim @@ -298,7 +298,7 @@ iterator typedParams*(n: NimNode, skip = 0): (NimNode, NimNode) = let paramType = paramNodes[^2] for j in 0 ..< paramNodes.len - 2: - yield (paramNodes[j], paramType) + yield (skipPragma paramNodes[j], paramType) macro unpackArgs*(callee: typed, args: untyped): untyped = result = newCall(callee) diff --git a/tests/test_objects.nim b/tests/test_objects.nim index 1fcd400..d6ae887 100644 --- a/tests/test_objects.nim +++ b/tests/test_objects.nim @@ -42,6 +42,8 @@ suite "Objects": Bar = object x: RootRef not nil + DistinctBar = distinct Bar + proc foo(x: int): string = discard @@ -57,6 +59,7 @@ suite "Objects": T3 = typeof foo(declval(lent int)) T4 = typeof foo(declval(Bar)) T5 = typeof foo(declval(var Bar)) + T6 = typeof declval(DistinctBar) check: T1 is string @@ -64,4 +67,6 @@ suite "Objects": T3 is string T4 is int T5 is int + T6 is DistinctBar + T6 isnot Bar