summary refs log tree commit diff stats
path: root/tests/generics/tgeneric0.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/generics/tgeneric0.nim')
-rw-r--r--tests/generics/tgeneric0.nim30
1 files changed, 29 insertions, 1 deletions
diff --git a/tests/generics/tgeneric0.nim b/tests/generics/tgeneric0.nim
index b5e1c4bb4..16a148f7b 100644
--- a/tests/generics/tgeneric0.nim
+++ b/tests/generics/tgeneric0.nim
@@ -9,7 +9,7 @@ float32
 """
 
 
-import tables
+import std/tables
 
 
 block tgeneric0:
@@ -166,3 +166,31 @@ type
 # bug #8295
 var x = AtomicContainer[int]()
 doAssert (ptr Block[int])(x.b) == nil
+
+
+# bug #23233
+type
+  JsonObjectType*[T: string or uint64] = Table[string, JsonValueRef[T]]
+
+  JsonValueRef*[T: string or uint64] = object
+    objVal*: JsonObjectType[T]
+
+proc scanValue[K](val: var K) =
+  var map: JsonObjectType[K.T]
+  var newVal: K
+  map["one"] = newVal
+
+block:
+  var a: JsonValueRef[uint64]
+  scanValue(a)
+
+  var b: JsonValueRef[string]
+  scanValue(b)
+
+block: # bug #21347
+  type K[T] = object
+  template s[T]() = discard
+  proc b1(n: bool | bool) = s[K[K[int]]]()
+  proc b2(n: bool) =        s[K[K[int]]]()
+  b1(false)   # Error: 's' has unspecified generic parameters
+  b2(false)   # Builds, on its own