Skip to content

Commit

Permalink
fix another ambiguous call snafu due to generics (#308)
Browse files Browse the repository at this point in the history
Basically, just changing an implicit generic into two functions.
  • Loading branch information
disruptek authored Jan 5, 2024
1 parent cfb12ca commit c53f084
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cps/normalizedast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,18 @@ func len*(n: NormNode): int {.borrow.}
func kind*(n: NormNode): NimNodeKind {.borrow.}
## the kind (`NimNodeKind`) of the underlying `NimNode`

proc add*(f: NimNode|NormNode, c: NormNode): NormNode {.discardable.} =
proc add*(f: NormNode, c: NormNode): NormNode {.discardable.} =
## add a child node, and return the parent for further chaining.
## created in order to fix ambiguous call issues
{.push hint[ConvFromXtoItselfNotNeeded]: off.}
result = NormNode f.NimNode.add(c.NimNode)
{.pop.}

proc add*(f: NimNode, c: NormNode): NormNode {.discardable.} =
## add a child node, and return the parent for further chaining.
## created in order to fix ambiguous call issues ... again.
f.NormNode.add(c.NormNode)

template findChild*(n: NormNode; cond: untyped): NormNode =
## finds the first child node matching the condition or nil
NormNode macros.findChild(n, cond)
Expand Down

0 comments on commit c53f084

Please sign in to comment.