summary refs log tree commit diff stats
path: root/tests/template
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template')
-rw-r--r--tests/template/mdotcall.nim22
-rw-r--r--tests/template/tdotcall.nim10
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/template/mdotcall.nim b/tests/template/mdotcall.nim
new file mode 100644
index 000000000..38a6ccae0
--- /dev/null
+++ b/tests/template/mdotcall.nim
@@ -0,0 +1,22 @@
+# issue #20073
+
+type Foo = object
+proc foo(f: Foo) = discard
+
+template works*() =
+  var f: Foo
+  foo(f)
+
+template boom*() =
+  var f: Foo
+  f.foo() # Error: attempting to call undeclared routine: 'foo'
+  f.foo # Error: undeclared field: 'foo' for type a.Foo
+
+# issue #7085
+
+proc bar(a: string): string =
+  return a & "bar"
+
+template baz*(a: string): string =
+  var b = a.bar()
+  b
diff --git a/tests/template/tdotcall.nim b/tests/template/tdotcall.nim
new file mode 100644
index 000000000..abcbc8bd5
--- /dev/null
+++ b/tests/template/tdotcall.nim
@@ -0,0 +1,10 @@
+import mdotcall
+
+# issue #20073
+works()
+boom()
+
+# issue #7085
+doAssert baz("hello") == "hellobar"
+doAssert baz"hello" == "hellobar"
+doAssert "hello".baz == "hellobar"