summary refs log tree commit diff stats
path: root/tests/macros/t23032_1.nim
blob: 4e1707414a89447b8e3473dc34088e9a7158ac8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import std/macros

type A[T, H] = object

proc `%*`(a: A): bool = true
proc `%*`[T](a: A[int, T]): bool = false

macro collapse(s: untyped) =
  result = newStmtList()
  result.add quote do:
    doAssert(`s`(A[float, int]()) == true)

macro startHere(n: untyped): untyped =
  result = newStmtList()
  let s = n[0]
  result.add quote do:
    `s`.collapse()

startHere(`a` %* `b`)