summary refs log tree commit diff stats
path: root/tests/stdlib/timportutils.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/stdlib/timportutils.nim')
-rw-r--r--tests/stdlib/timportutils.nim56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/stdlib/timportutils.nim b/tests/stdlib/timportutils.nim
index 37e2b7102..be912e702 100644
--- a/tests/stdlib/timportutils.nim
+++ b/tests/stdlib/timportutils.nim
@@ -38,6 +38,55 @@ template main =
 
     block:
       assertAll:
+        not compiles(E[int](he1: 1))
+        privateAccess E[int]
+        var e = E[int](he1: 1)
+        e.he1 == 1
+        e.he1 = 2
+        e.he1 == 2
+        e.he1 += 3
+        e.he1 == 5
+        # xxx caveat: this currently compiles but in future, we may want
+        # to make `privateAccess E[int]` only affect a specific instantiation;
+        # note that `privateAccess E` does work to cover all instantiations.
+        var e2 = E[float](he1: 1)
+
+    block:
+      assertAll:
+        not compiles(E[int](he1: 1))
+        privateAccess E
+        var e = E[int](he1: 1)
+        e.he1 == 1
+
+    block:
+      assertAll:
+        not compiles(F[int, int](h3: 1))
+        privateAccess F[int, int]
+        var e = F[int, int](h3: 1)
+        e.h3 == 1
+
+    block:
+      assertAll:
+        not compiles(F[int, int](h3: 1))
+        privateAccess F[int, int].default[].typeof
+        var e = F[int, int](h3: 1)
+        e.h3 == 1
+
+    block:
+      assertAll:
+        var a = G[int]()
+        var b = a.addr
+        privateAccess b.type
+        discard b.he1
+        discard b[][].he1
+
+    block:
+      assertAll:
+        privateAccess H[int]
+        var a = H[int](h5: 2)
+
+    block:
+      assertAll:
         privateAccess PA
         var pa = PA(a0: 1, ha1: 2)
         pa.ha1 == 2
@@ -46,6 +95,13 @@ template main =
 
     block:
       assertAll:
+        var b = BAalias()
+        not compiles(b.hb1)
+        privateAccess BAalias
+        discard b.hb1
+
+    block:
+      assertAll:
         var a = A(a0: 1)
         var a2 = a.addr
         not compiles(a2.ha1)