summary refs log tree commit diff stats
path: root/tests/accept
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-10-25 15:26:36 +0200
committerAraq <rumpf_a@web.de>2011-10-25 15:26:36 +0200
commit9fb36bd20c76ebffa98dfa859f49756972b9491b (patch)
tree60b63ee0026a0c3dde2dec5365070d852d0a3803 /tests/accept
parent9fb97e24bf05fa980bcc781dd4b32fd3efed48a0 (diff)
downloadNim-9fb36bd20c76ebffa98dfa859f49756972b9491b.tar.gz
compilation cache: mostly working; generics not yet
Diffstat (limited to 'tests/accept')
-rw-r--r--tests/accept/run/mfriends.nim11
-rw-r--r--tests/accept/run/tfriends.nim11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/accept/run/mfriends.nim b/tests/accept/run/mfriends.nim
new file mode 100644
index 000000000..f1c663655
--- /dev/null
+++ b/tests/accept/run/mfriends.nim
@@ -0,0 +1,11 @@
+
+type
+  TMyObj = object 
+    x: int
+    
+proc gen*[T](): T = 
+  var d: TMyObj
+  # access private field here
+  d.x = 3
+  result = d.x
+
diff --git a/tests/accept/run/tfriends.nim b/tests/accept/run/tfriends.nim
new file mode 100644
index 000000000..1e70d50a5
--- /dev/null
+++ b/tests/accept/run/tfriends.nim
@@ -0,0 +1,11 @@
+discard """
+  output: "3"
+"""
+
+# Tests that a generic instantiation from a different module may access
+# private object fields:
+
+import mfriends
+
+echo gen[int]()
+