Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- BaseType = ref object of RootObj
- a: int
- BContainer = tuple
- b: int
- MyType = ref object of BaseType
- method Yay[M](obj:BaseType):seq[M] {.base.} =
- echo "Base Yay"
- method Yay[BContainer](obj:MyType):seq[BContainer] =
- echo "MyType Yay"
- return @[(10,)]
- proc DoSomething[T,M](obj:var T,genType:M) =
- var yay = obj.Yay()
- echo yay
- var b = new MyType
- DoSomething(b, (1,))
- # dstn.nim(22, 12) template/generic instantiation from here
- # dstn.nim(18, 16) template/generic instantiation from here
- # dstn.nim(13, 12) Error: cannot instantiate: 'BContainer'
Add Comment
Please, Sign In to add comment