diff options
Diffstat (limited to 'tests/accept')
-rw-r--r-- | tests/accept/run/mfriends.nim | 11 | ||||
-rw-r--r-- | tests/accept/run/tfriends.nim | 11 |
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]() + |