summary refs log tree commit diff stats
path: root/tests/trmacros/tpartial.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/trmacros/tpartial.nim')
-rw-r--r--tests/trmacros/tpartial.nim11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/trmacros/tpartial.nim b/tests/trmacros/tpartial.nim
new file mode 100644
index 000000000..fdaa3414a
--- /dev/null
+++ b/tests/trmacros/tpartial.nim
@@ -0,0 +1,11 @@
+discard """
+  output: '''-2'''
+"""
+
+proc p(x, y: int; cond: bool): int =
+  result = if cond: x + y else: x - y
+
+template optP{p(x, y, true)}(x, y: expr): expr = x - y
+template optP{p(x, y, false)}(x, y: expr): expr = x + y
+
+echo p(2, 4, true)
niel Santos <dacs.git@brilhante.top> 2023-04-11 19:40:34 +0100 committer Daniel Santos <dan.git@brilhante.top> 2023-07-01 10:06:43 +0100 Profani-tty has reborn' href='/danisanti/profani-tty/commit/src/plugins/python_api.h?id=a4ca6291afe1e407b72b2ec03bffc595946071f3'>a4ca6291 ^
0fc0b3ee ^



a4ca6291 ^
0fc0b3ee ^




a4ca6291 ^
0fc0b3ee ^














9cff3735 ^

0fc0b3ee ^

71ccfcc0 ^
0fc0b3ee ^

a2726b6a ^


0fc0b3ee ^
a2726b6a ^
376811a9 ^
0fc0b3ee ^
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
40
41
42
43
44
45
46
47
48
49