summary refs log tree commit diff stats
path: root/tests/macros/tnodecompare.nim
blob: 3870c75592f6a3c75ba73e8b75fc38d6a0241867 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
discard """
output: '''true
false
true
false
true
false
true
false'''
"""

import macros

macro test(a: typed, b: typed): expr =
  newLit(a == b)

echo test(1, 1)
echo test(1, 2)

type
  Obj = object of RootObj
  Other = object of RootObj

echo test(Obj, Obj)
echo test(Obj, Other)

var a, b: int

echo test(a, a)
echo test(a, b)

macro test2: expr =
  newLit(bindSym"Obj" == bindSym"Obj")

macro test3: expr =
  newLit(bindSym"Obj" == bindSym"Other")

echo test2()
echo test3()