Hello, I have some problems with generics. I have four similar situations in which only one can succeed.
Failed case one: [https://play.nim-lang.org/#ix=2r7Q](https://play.nim-lang.org/#ix=2r7Q) type Must*[U: object; T: object | ref object] = object impl*: U data*: T Animal[T] = object Cat = object template must(a, b: typed): untyped = Must[a[b], b] var a: must(Animal, Cat) # failed proc initZ[T](must: Must[Animal[T], T]) = discard Run Failed case two: [https://play.nim-lang.org/#ix=2r7R](https://play.nim-lang.org/#ix=2r7R) type Must*[U: object; T: object | ref object] = object impl*: U data*: T Animal[T] = object Cat = object template must(a, b: typed): untyped = Must[a[b], b] var a: must(Animal, Cat) # failed proc init[T](must: must(Animal, T)) = discard Run Failed case three: [https://play.nim-lang.org/#ix=2r7S](https://play.nim-lang.org/#ix=2r7S) type Must*[U; T: object | ref object] = object impl*: U data*: T Animal[T] = object Cat = object template must(a, b: typed): untyped = Must[a[b], b] var a: must(Animal, Cat) # failed proc init[T](must: must(Animal, T)) = discard Run Successive Case: [https://play.nim-lang.org/#ix=2r7U](https://play.nim-lang.org/#ix=2r7U) type Must*[U; T: object | ref object] = object impl*: U data*: T Animal[T] = object Cat = object template must(a, b: typed): untyped = Must[a[b], b] var a: must(Animal, Cat) # succeded proc initZ[T](must: Must[Animal[T], T]) = discard initZ[Cat](must = Must[Animal[Cat], Cat]()) Run
