summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-02-04 17:29:34 +0100
committerAraq <rumpf_a@web.de>2014-02-04 17:29:34 +0100
commitc097acedd30602fba903ed4ee132b5e5bae91017 (patch)
tree9f9699827b48c3c0d3b2c98b19881c361467a239 /tests/template
parent96e616198d100f0e10337c0210b088730d66d91e (diff)
downloadNim-c097acedd30602fba903ed4ee132b5e5bae91017.tar.gz
bugfix: immediate templates are preferred consistently (danger: breaks code)
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/tprefer_immediate.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/template/tprefer_immediate.nim b/tests/template/tprefer_immediate.nim
new file mode 100644
index 000000000..578f447b0
--- /dev/null
+++ b/tests/template/tprefer_immediate.nim
@@ -0,0 +1,17 @@
+discard """
+  output: '''immediate'''
+"""
+
+# Test that immediate templates are preferred over non-immediate templates
+
+template foo(a, b: expr) = echo "foo expr"
+
+template foo(a, b: int) = echo "foo int"
+template foo(a, b: float) = echo "foo float"
+template foo(a, b: string) = echo "foo string"
+template foo(a, b: expr) {.immediate.} = echo "immediate"
+template foo(a, b: bool) = echo "foo bool"
+template foo(a, b: char) = echo "foo char"
+
+foo(undeclaredIdentifier, undeclaredIdentifier2)
+