Skip to content

Commit

Permalink
typedParams will now handle parameters with pragmas
Browse files Browse the repository at this point in the history
  • Loading branch information
zah committed May 23, 2020
1 parent a695d9e commit f003557
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stew/shims/macros.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions tests/test_objects.nim
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ suite "Objects":
Bar = object
x: RootRef not nil

DistinctBar = distinct Bar

proc foo(x: int): string =
discard

Expand All @@ -57,11 +59,14 @@ 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
T2 is float
T3 is string
T4 is int
T5 is int
T6 is DistinctBar
T6 isnot Bar

0 comments on commit f003557

Please sign in to comment.