summary refs log tree commit diff stats
path: root/tests/ambsym/tambsym2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ambsym/tambsym2.nim')
-rw-r--r--tests/ambsym/tambsym2.nim24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ambsym/tambsym2.nim b/tests/ambsym/tambsym2.nim
new file mode 100644
index 000000000..745427c54
--- /dev/null
+++ b/tests/ambsym/tambsym2.nim
@@ -0,0 +1,24 @@
+discard """
+  file: "tambsym2.nim"
+  output: "7"
+"""
+# Test overloading of procs with locals
+
+type
+  TMyType = object
+    len: int
+    data: string
+    
+proc len(x: TMyType): int {.inline.} = return x.len
+
+proc x(s: TMyType, len: int) = 
+  writeln(stdout, len(s))
+  
+var
+  m: TMyType
+m.len = 7
+m.data = "1234"
+
+x(m, 5) #OUT 7
+
+