The following should work. It may not be what you want though, which I believe is 'subtyping in the generic constraints', right? type Foo = object of RootObj Bar = object of Foo Baz[T: Foo | Bar] = object myAttribute: T let baz = Baz[Foo]() # compiles let baz2 = Baz[Bar]() Run
- Generic type parameters and inheritance hnicke
- Generic type parameters and inheritance GamzWithJamz
- Generic type parameters and inheritance GamzWithJamz
- Generic type parameters and inheritance GamzWithJamz
- Generic type parameters and inheritance Yardanico
- Generic type parameters and inheritance bpr
- Generic type parameters and inherit... GamzWithJamz
- Generic type parameters and inh... GamzWithJamz
- Generic type parameters and inh... boia01
- Generic type parameters and inh... hnicke
- Generic type parameters and inh... shirleyquirk